Moderators: Sascha Willems, walaber
pHySiQuE wrote:One thought: If it is not important to other people, why not just permanently switch the X and Z axes to match our needs? Perhaps that is easier than adding the vehicle frame?
Julio Jerez wrote:If anything I will probably go more to the system used in the scientific simulation which is
x front, y left and z down.
an like I said this is a matter of a transformation.
dMatrix chassisMatrix;
chassisMatrix.m_front = dVector (1.0f, 0.0f, 0.0f, 0.0f); // this is the vehicle direction of travel
chassisMatrix.m_up = dVector (0.0f, 1.0f, 0.0f, 0.0f); // this is the downward vehicle direction
// chassisMatrix.m_front = dVector (0.0f, 0.0f, 1.0f, 0.0f); // this is the vehicle direction of travel
// chassisMatrix.m_up = dVector (0.0f, 1.0f, 0.0f, 0.0f); // this is the downward vehicle direction
chassisMatrix.m_right = chassisMatrix.m_front.CrossProduct(chassisMatrix.m_up); // this is in the side vehicle direction (the plane of the wheels)
chassisMatrix.m_posit = dVector (0.0f, 0.0f, 0.0f, 1.0f);
// create a default vehicle
m_controller = manager->CreateVehicle (chassisCollision, chassisMatrix, definition.m_vehicleMass, PhysicsApplyGravityForce, DEMO_GRAVITY);
dCustomVehicleController* dCustomVehicleControllerManager::CreateVehicle(NewtonBody* const body, const dMatrix& vehicleFrame, NewtonApplyForceAndTorque forceAndTorque, dFloat gravityMag)
{
dCustomVehicleController* const controller = CreateController();
controller->Init (body, forceAndTorque, gravityMag);
return controller;
}
dCustomVehicleController* dCustomVehicleControllerManager::CreateVehicle(NewtonCollision* const chassisShape, const dMatrix& vehicleFrame, dFloat mass, NewtonApplyForceAndTorque forceAndTorque, dFloat gravityMag)
{
dCustomVehicleController* const controller = CreateController();
controller->Init(chassisShape, mass, forceAndTorque, gravityMag);
return controller;
}
Users browsing this forum: No registered users and 18 guests