Jump to content
  • Advertisement
Sign in to follow this  
mrWodoo

[ODE] Ode matrix to directx matrix problem

This topic is 2574 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

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;


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!