Car Physics Help : Turning Out Of Corners

mr_burns

16-03-2008 08:30:17

Hi all,

I working through some of the PhysX tutorials, which are pretty good (for anyone interested).

I'm looking to improve on the Vehicle tutorial, particularly, 703 and 704, which is 3 and 4 wheeled drive vehicles.

Firstly, I'm trying to implement a more OO solution, which is gearing up something like this:


bool
CCar::Process(float _fDelta)
{
if (m_bBraking) // car is braking, set via the CInputMgr
{
m_bBraking = false;

// rear-wheel drive
wheel3->setBrakeTorque( m_fBrakeTorqueVal *= _fDelta );
wheel4->setBrakeTorque( m_fBrakeTorqueVal *= _fDelta );
}

if (m_bAccelerating) // car is accelerating
{
m_bAccelerating = false;

wheel3->setMotorTorque( m_fMotorTorqueVal *= _fDelta );
wheel4->setMotorTorque( m_fMotorTorqueVal *= _fDelta );
}

if (m_bTurning) // car is turning
{
m_bTurning = false;

wheel1->setSteerAngle( m_fSteerAngle *= _fDelta );
wheel2->setSteerAngle( m_fSteerAngle *= _fDelta );
}

//
// At this point, maybe I should check if the car is not turning,
// and begin to reset the front wheel turning angles, back towards
// zero?
// Simulating when a driver coming out of a corner, takes her
// hands off the steering wheel.
//

return (true);
}



Any ideas welcome. I'm trying to figure out where and how I should start to re-align the front wheels to their base starting angle (if that makes sense).

Here's a link to the PhysX tutorial (for those interested):
http://devsupport.ageia.com/ics/support ... eptID=1949

I understand that this is a OgreNewt thread, but figured that this is a generic physics question, and hoping that someone here can give me a +2

Thanks again.