[ODE] How to use the rotation matrix for DX

Paul Carrington paul at vulcan.co.uk
Mon Oct 11 20:56:28 MST 2004


[ODE] How to use the rotation matrix for DX
Originally asked by Duncan Frostick <duncanf at f2s.com>

Here's a quick way of filling in the first 3x3 part of a DX matrix (for the rotaional
elements)... pass the dBodyID and the D3DMATRIX to get filled

void FillDXRotMatrix  (dBodyID &b, D3DMATRIX &m)
{
 m(0,0) = b->_R(0,0);
 m(0,1) = b->_R(1,0);
 m(0,2) = b->_R(2,0);
 m(1,0) = b->_R(0,1);
 m(1,1) = b->_R(1,1); 
 m(1,2) = b->_R(2,1);
 m(2,0) = b->_R(0,2);
 m(2,1) = b->_R(1,2);
 m(2,2) = b->_R(2,2);
}

But depending on your DX axis orientations you may want to rip the euler angles
from the ode matrix and reconstruct a DX matrix using those euler angles.. this will
only be required if your DX axis's orientation is like this (which i suspect it is)

http://www.vulcan.co.uk/artwork/xyz.jpg

Hope any of that helps

kind regards
Paul Carrington


More information about the ODE mailing list