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

Jack Nova jack.nova at gmx.de
Wed Jul 28 12:25:13 MST 2004


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.



More information about the ODE mailing list