Dynamically creating a hinge constraint

Myriade
Posts: 2
Joined: Sun Jun 07, 2009 3:24 pm

Dynamically creating a hinge constraint

Post by Myriade »

Hi!

I need to make a simple game in which arrows shot to a target should
get attached to it when a collision occurs.

Object A is floating in space. When an arrow hits an object A, I need
to create a hinge constraint between the arrow and "A", according to
the position of the arrow relative to "A". How do I figure out the
arguments to provide to the btHingeConstraint constructor ?

The names of the arguments for the btHingeContraint constructor are :
  • * btRigidBody &rbA,
    * btRigidBody &rbB,
    * const btVector3 &pivotInA,
    * const btVector3 &pivotInB,
    * btVector3 &axisInA,
    * btVector3 &axisInB
    * bool useReferenceFrameA=false
...actually, I am not even sure this is the correct constraint to
create between objects A and the arrow. I need the arrow to be loosely
attached to object "A". Is it the correct kind of constraint to create
? If so, how do I figure out how to set their position to stay the way
it is when I detect a collision ?

I also need to detect collisions between objects ! How should I do so ?

Thanks a lot !