Home › Forums › Programming › Car PhysX Help : Turning Out Of Corners
- This topic has 2 replies, 3 voices, and was last updated 16 years, 1 month ago by Anonymous.
-
AuthorPosts
-
-
16/03/2008 at 8:09 am #6628AnonymousInactive
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:
[code:1:d58f6e5cc3]
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);
}[/code:1:d58f6e5cc3]
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/default.asp?deptID=1949You will need an account (their free).
-
16/03/2008 at 3:54 pm #40484AnonymousInactive
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).
[/quote:852d3dd6cb]First, just a general point. It’s usually a very good idea to make any of these controls fully analogue (i.e. no discontinuous switches of torque or directions), but it looks like the _fDelta may be accomplishing that, but you’d normally have separate controls for each function. If you’re hooked up to a steering wheel or analogue controller, you’ll normally have some non-linear relationship between the controller feedback and the value you’re controlling with differing dead-zones and response curves.
So for the steering system, you’ll have a deadzone near the 0 angle and allow the angle to vary continuously as the wheel is turned. If controlling with a keyboard then you’ll implement a proxy steering mechanism which uses a simple feedback controller to implement the same basic process.
Another point is that you shouldn’t expect to get any fast driving behaviour from this approach. Real physically modelled wheels (rigid bodies) only work for slow driving / off road sims, up to about 30 mph or thereabouts. Once beyond this (the actual speed depends on lots of specific factors) you can no longer effectively model the continuous contact between tyre and ground, you’ll have tons of intermittent contacts, and the ability to steer or otherwise control the vehicle will be lost. In these situations you need to swtich to a more "modelled" approach like ray casting, where a specific wheel contact friction model can be fully controlled…
Not sure if this is any use at all.
There is tons of info available on this topic over many forums. A good starting point is http://www.racer.nl/ – check the forums and links.]
Steve
-
19/03/2008 at 12:20 am #40496AnonymousInactive
fun stuff :)
If you want to model a road vehicle travelling at speed I would strongly recommend looking into using a raycast-based tyre and suspension model as Steve suggested. Pacejka’s magic tyre formula is documented in a few places around the web – and it gives pretty satisfying results for on-road handling when combined with a decent suspension implementation.
-
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.