[ODE] Ode matrix to directx matrix problem

Started by
1 comment, last by RobTheBloke 12 years, 5 months ago
This is my 'convert' matrix method

void Game::ODEConvertMatrix( D3DXMATRIX &t, const dReal *bMat,
const dReal *bPos)
{
t._11 = bMat[0];
t._12 = bMat[4];
t._13 = bMat[8];
t._14 = 0;
t._21 = bMat[1];
t._22 = bMat[5];
t._23 = bMat[9];
t._24 = 0;
t._31 = bMat[2];
t._32 = bMat[6];
t._33 = bMat[10];
t._34 = 0;
t._41 = bPos[0];
t._42 = bPos[2];
t._43 = bPos[1];
t._44 = 1;

}


Everything is almost ok, but rotation is weird...

Here is demo
http://www.mediafire.com/?akv4ylp1bv77cb8
Advertisement
Due to your position indexes being swapped around. you're doing more than just the normal ode->d3d conversion (a minor memory detail, which you appear to understand correctly).

You're changing coordinate systems. In other words, Y is no longer "up". You'll need to incorporated the same swapping in the rotation (inner 3x3) that you did for the position.

0, 8, 4
1, 9, 5
2, 10, 6

.. just speculating though. Good luck!

You're changing coordinate systems. In other words, Y is no longer "up". You'll need to incorporated the same swapping in the rotation (inner 3x3) that you did for the position.


Y or Z up is *not* a change in coordinate systems. One would imagine the problem is that the ODE matrix is right handed, whereas D3D expects left handed matrices. The solution is to reflect the matrix through the Z axis.....


Matrix reflect;
reflect.makeScaleMatrix(1,1,-1);
Matrix ODE;
Matrix D3D;
D3D = reflect * ODE * reflect;


This topic is closed to new replies.

Advertisement