//synchronize the wheels with the (interpolated) chassis worldtransform
l_vehicle->updateWheelTransform(j,true);
const btTransform& t = l_vehicle->getWheelInfo(j).m_worldTransform;
D3DXMATRIX l_mat = BT2DX_MATRIX(t);
D3DXMATRIX l_rot;
D3DXMatrixRotationY(&l_rot, 1.57f);
l_mat = l_rot * l_mat;
// assume front wheels
AgentMotionState* motion
= dynamic_cast(l_vehicle->getRigidBody()->getMotionState());
if (motion)
{
boost::shared_ptr pObj = motion->m_object;
if (j==0)
{
D3DXVECTOR3 s, p;
D3DXQUATERNION r;
D3DXMatrixDecompose(&s, &r, &p, &l_mat);
double yaw, pitch, roll;
yaw = pitch = roll = 0.0f;
QuatToEuler(r, yaw, pitch, roll);
TRACE("Veh: " << i << "Pos of wheel 0 is " << p.x << " " << p.y << " " << p.z);
yaw = CapRadian(yaw);
TRACE("Veh: " << i << "Rot of wheel 0 is " << yaw);
FRAME* frontWheels = (FRAME*)D3DXFrameFind(pObj->m_mesh->GetFrameRoot(), "Front_Left_Wheel");
frontWheels->matCombined = l_mat;
//frontWheels->TransformationMatrix = l_mat;
}
Looks like the left front wheel is on the far left of the chassis with a large gap?
Why is that?
Thanks
Jack
↧