# [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.

## 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 on other sites
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 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; 

1. 1
2. 2
Rutin
29
3. 3
4. 4
5. 5
khawk
14

• 11
• 11
• 23
• 10
• 9
• ### Forum Statistics

• Total Topics
633648
• Total Posts
3013111
×