[ODE] Universal Joint / Arm -> rotating about its own axis
Martin C. Martin
martin at metahuman.org
Thu Apr 3 05:32:02 2003
David Nicolier wrote:
>
> I'm trying to create a RagDoll demo, and I have some issues
> with the Universal Joint (using ODE 0.035 OldCol/TriCol/Opcode1.2).
> I have connected my arms and legs with universal joints to
> the body. They seem to behave correctly, but time to time,
> they do rotate about their own axis. I was wondering if I
> could do something to prevent this from happening... or
> if I did something wrong in my code. (I tried all the axis
> combination, none solved it)
>
> PS : The init for a Leg looks like this :
>
> dJointID jointID = dJointCreateUniversal(g_WorldID, 0);
> dJointAttach( jointID, bodyBodyID, bodyLegID );
> dJointSetUniversalAnchor( jointID, LegBasePos->x, LegBasePos->y,
> LegBasePos->z );
> dJointSetUniversalAxis1( jointID, 1, 0, 0 );
> dJointSetUniversalAxis2( jointID, 0, 1, 0 );
>
> Small drawing of the axis, and my character :
>
> Z _ O _
> ^ [_]
> | | |
> Y-->X
Is LegBasePos the location, in world coordinates, where the center of the
top face of the leg touches the body?
What the universal joint will do is keep the vector, attached to the top
surface of the leg, that points from the back of the leg to the front,
perpendicular to the vector, attached to the bottom surface of the body,
that goes from the body's right to its left. Is that what you observe?
They may need to rotate about their own axis a little bit within each
timestep so that a long sequence of motions results in no overall rotation
about the axis.
- Martin