[ODE] Re: Rotation troubles

nlin@nlin.net nlin at nlin.net
Thu Feb 28 19:58:02 2002


> Only if I 
> send in the matrix as described in the above setTransform() call (which 
> swaps row/col), and then use the matrix returned from dBodyGetXXX raw do 
> I get expected and desired results.

As I understand it, this is incorrect. dBodyGetXXX returns a row-major
matrix, i.e. the first four elements are the first row of the 3x4 (row x col)
orientation matrix, where each row is zero-padded with a fourth zero-element.
OpenGL expects a column-major matrix, where the first four elements in memory
are the first column of the orientation.

You can think of a matrix as a coordinate system, where, when you write the
matrix on paper, the first column represents the local x axis, the second
column the y axis, and the third column the z axis. To debug such matrix
transformations, you always need to ask yourself, "which elements in memory
represent my x axis?" Is it elements 0,1,2 (column-major, OpenGL), or is
it elements 0,4,8 (row-major, ODE)?

Post a simple compilable example code with expected and actual results and
I can comment more.

-Norman