Code: Select all
m_Raycaster = new btDefaultVehicleRaycaster(m_World);
m_RVehicle = new btRaycastVehicle(m_Tuning,m_Chassis,m_Raycaster);
m_Chassis->setActivationState(DISABLE_DEACTIVATION);
AddAllWheels(a_Wheel, a_Transforms);
m_World->addVehicle(m_RVehicle);
btVector3 wheelDirectionCS0(0, 0,-1);
//The axis which the wheel rotates arround
btVector3 wheelAxleCS(0,1,0);
btScalar wheelWidth = a_Wheel->getHalfHeight() * 2.f;
btScalar wheelRadius = a_Wheel->getRadius();
btVector3 trans = a_Transforms["FL"].getOrigin();
btScalar suspensionRestLength = 0.2;
btVector3 wheelConnectionPoint(trans.getY() + wheelRadius,trans.getZ() + wheelWidth,wheelRadius *2.f);
//Adding front wheels
m_RVehicle->addWheel(wheelConnectionPoint, wheelDirectionCS0, wheelAxleCS, suspensionRestLength,a_Wheel->getRadius(), m_Tuning, true);
m_RVehicle->addWheel(wheelConnectionPoint * btVector3(1, -1, 1), wheelDirectionCS0, wheelAxleCS, suspensionRestLength, a_Wheel->getRadius(), m_Tuning, true);
//Adds the rear wheels
m_RVehicle->addWheel(wheelConnectionPoint * btVector3(-1, 1, 1), wheelDirectionCS0, wheelAxleCS, suspensionRestLength, a_Wheel->getRadius(), m_Tuning, false);
// //
m_RVehicle->addWheel(wheelConnectionPoint * btVector3(-1, -1, 1), wheelDirectionCS0, wheelAxleCS, suspensionRestLength, a_Wheel->getRadius(), m_Tuning, false);
//
![Smile :)](./images/smilies/icon_smile.gif)