[ODE] converting opengl matrices to ODE positions. or something!

Dan danfrith at gmail.com
Sat Sep 10 18:34:22 MST 2005


Thanks! that works. I have done the reverse to set the ode positions
from a matrix and that seems to work too.

I have a couple more queries while i'm here.

I notice that elements 3, 7, and 11 (counting from 0) of the rotation
matrix are not used. Is this significant?

Also, if I use scaling on the gl matrices, will this method of
conversion still work?
Would I have to do some scaling upon whatever the collision functions
are? (although I haven't tried collisions yet so I might be asking the
question wrong)

On 9/10/05, Railey, Ken <krailey at amazon.com> wrote:
> 
> 
> GLfloat local_matrix[16];
> 
> void set_matrix (const float pos[3], const float R[12]) {
>     local_matrix[0]    =     R[0];
>     local_matrix[1]    =     R[4];
>     local_matrix[2]    =     R[8];
>     local_matrix[3]    =     0;
>     local_matrix[4]    =     R[1];
>     local_matrix[5]    =     R[5];
>     local_matrix[6]    =     R[9];
>     local_matrix[7]    =     0;
>     local_matrix[8]    =     R[2];
>     local_matrix[9]    =     R[6];
>     local_matrix[10] =     R[10];
>     local_matrix[11] =     0;
>     local_matrix[12] =     pos[0];
>     local_matrix[13] =     pos[1];
>     local_matrix[14] =     pos[2];
>     local_matrix[15] =     1;
> }
> 
> set_matrix( dBodyGetPosition(body), dBodyGetRotation(body));
> glMultMatrixf (local_matrix);
> 
> 
> HTH
> -Ken



More information about the ODE mailing list