Setting body orientation in ODE

This topic is 4882 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I've got a CameraRig class that is just an ODE sphere. When I press the arrow keys I apply forces to it that move it around. That works pretty good. Now what I'm trying to do is change the orientation of the sphere depending on mouse movement. How do I do it? This is what I'm trying to do for changing the pitch of the camera:
// the CameraRig is inherited from CDynamicObject
{
const real * qnow = dBodyGetQuaternion(physicsBody);

dQuaternion qlater;
dQFromAxisAndAngle(qlater, 1, 0, 0, amount);

dQuaternion finish;
dQMultiply0(finish, qnow, qlater);

dBodySetQuaternion(physicsBody, finish);
}
This isn't really working. If I move the mouse a huge amount over a single frame (really fast, in other words) the orientation will jump somewhere else, otherwise it just sits there.

Share on other sites
Hmm, I think I might be on to something. The ODE docs (and the comments in the headers even) say that a dMatrix3 is a 4x3 matrix, but actually I have to treat it like a 3x4 matrix (3 rows and 4 columns). When I do that things start working.

Is there something I'm not getting? 1st number in dimension is the number of rows and the 2nd is the number of columns, right? So this is a 4x3 matrix:
[ a b c ][ d e f ][ g h i ][ j k l ]

and this is a 3x4 matrix:
[ a b c d ][ e f g h ][ i j k l ]

right?

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• Forum Statistics

• Total Topics
632960
• Total Posts
3009481
• Who's Online (See full list)

There are no registered users currently online

×