[ODE] ODE in Virtools ... What's wrong ?

Jon Watte hplus-ode at mindcontrol.org
Thu Jul 29 01:05:01 MST 2004


AAARGH! STOP IT ALREADY! THERE IS NO NEED TO CONVERT BETWEEN LEFT-HANDED AND RIGHT-HANDED MATRICES, VECTORS OR QUATERNIONS!!!


Sorry to shout, but this should be made abundantly clear in the documentation. ODE is handedness neutral. If you plug in data from right-handed systems, then the data you get out should be interpreted right-handed. If you plug in data from left-handed systems, then the data you get out should be interpreted left-handed. There is no conversion necessary -- it all Just Works because it's all Just Math.

If you find you're having to convert matrices, perhaps it's because of a row-major versus column-major convention problem? Or perhaps a row-vector-pre versus column-vector-post convention problem? (If you have both, then you don't need to worry because they cancel out ;-)

Cheers,

			/ h+


-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of Jack
Nova
Sent: Wednesday, July 28, 2004 3:25 AM
To: ODE at q12.org
Subject: Re: [ODE] ODE in Virtools ... What's wrong ?


Hi Sébastien
I guess there is something wrong with the left / right handed conversion.
I got something like this too (if i remenber).

So what I know in Virtools (I was a developer for Michael Schumacher Kart
Racer 2002 :-))
its Matrix based on DirectX, so here some conversion Methods :

Virtools -> DX Matrix:
vRight : (m._11, m._12, m._13)
vUp : (m._21, m._22, m._23)
vDir : (m._31, m._32, m._33)
vPos : (m._41, m._42, m._43)

// DX Matrix -> ode
void COdeGeom::SetRefMatrix(const D3DXMATRIX mR)
{
dMatrix3 dR;
dR[0] = mR._11; dR[4] = mR._12; dR[8] = mR._13;
dR[1] = mR._21; dR[5] = mR._22; dR[9] = mR._23;
dR[2] = mR._31; dR[6] = mR._32; dR[10] = mR._33;
dR[3] = 0; dR[7] = 0; dR[11] = 0;
dGeomSetRotation(m_GeomID, dR);
dGeomSetPosition(m_GeomID, mR._41, mR._42, mR._43);
}

// ode -> DX Matrix
D3DXMATRIX COdeGeom::GetRefMatrix()
{
const dReal *odePos = dGeomGetPosition(m_GeomID);
const dReal *odeRot = dGeomGetRotation(m_GeomID);
D3DXMATRIX dxTrans = D3DXMATRIX(
odeRot[0], odeRot[4], odeRot[8], 0.0f,
odeRot[1], odeRot[5], odeRot[9], 0.0f,
odeRot[2], odeRot[6], odeRot[10], 0.0f,
odePos[0], odePos[1], odePos[2], 1.0f);
return dxTrans;
}

and for Quternion (till now i didn't test this, but it should be right)

// DX Quater -> ode
void COdeGeom::SetQuaternion(const D3DXQUATERNION qI)
{
dQuaternion dQ;
dQ[0] = qI.w;
dQ[1] = qI.x;
dQ[2] = qI.y;
dQ[3] = qI.z;
dGeomSetQuaternion(m_GeomID, dQ);
}

// ode -> DX Quater
D3DXQUATERNION COdeGeom::GetQuaternion()
{
dQuaternion odQ;
dGeomGetQuaternion(m_GeomID, odQ);
D3DXQUATERNION dxQ(odQ[1], odQ[2], odQ[3], odQ[0]);
return dxQ;
}


I hope its helps

R.H.

_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode




More information about the ODE mailing list