[ODE] Re: Mapping to OpenGL axis system

Ruud van Gaal ruud at marketgraph.nl
Thu Nov 22 13:18:01 MST 2001


Hi Jason,

> Just a guess on my part, but maybe you're building the OpenGL
> matrix wrong? Here's how I do it:
>
> const dReal* pos = dBodyGetPosition(body);
> const dReal* rot = dBodyGetRotation(body);
>
> m[0][0] = rot[0];
> m[0][1] = rot[4];
> m[0][2] = rot[8];
...

Yes, I noticed the storage of ODE's 4x3 matrices uses a storage that is 
transposed wrt OpenGL. I don't think that's my problem anymore, since I use 
nearly the same DMatrix3 class (same storage, except that my class is 3x3 and 
ODE uses 4x3). I checked my calculations I did when I criticized 
dBodyAddRelTorque() onscreen and on paper and they all matched. The I matrix 
maps onto the screen as I expect, and so do the rotated ones. When adding 
relative (body coordinate) torques however, things go wrong. I'm quite positive 
using R instead of transpose(R) is the problem.
Using dBodyAddTorque() should be just fine.

> Jason
>
> PS - So are *all* the r.a.s. racesims using ODE now? ;)

Seems all of them have at least looked at them. :) Not a bad thing in itself 
since that means enough support to keep it growing.

Ruud




More information about the ODE mailing list