Sign in to follow this  
Cthulhu32

Front wheel/back wheel old school physics

Recommended Posts

Ok, so this is a problem that has been bugging me for a long time. I love making little physics demos moving things around, bouncing them around, all that good stuff. But I have not found/come up with a good solution for the way the old school programmers did games such as Sprint and Badlands (games you can try in MAME or on the NES). Basically, what it "feels" like is the car is being turned on a pivot point of the nose. That way the velocity pushes you and makes your car drift, which makes cornering really fun. so now how to go about coding this? Currently my code is pretty simple, you have a velocity vector containing the angle and the length (vector.angle, vector.z) and you move the angle based on turning the wheel. The angle.z is brought up to a maximum velocity depending on how long the key has been pressed. any help or ideas would be greatly appreciated!

Share this post


Link to post
Share on other sites
You want to keep track of more than just velocity. You want to run a physics simulation of your car.

For parameters in your physics simulation, try:
Velocity of Car. (speed and direction)
Angle of Car and Rate Angle of Car is Changing.
Angle of Front Wheels and Speed of Rotation of Front Wheels.
Speed of Rotation of Back Wheels (and maybe Angle, if back wheels can turn relative to the car).
Current Power output of Engine.

Each timeslice, you take the above parameters, and you advance your simulation.

Ideally you want to take into account the wheel's ability to grip (and slip).

Wheels that are not pointing the way you are going will generate sideways forces on the car. Wheels with enough power will generate forward forces on the car -- wheels without enough power will generate backwards forces. Wheels that grip and move with the road, and wheels that have "slipped" behave differently (static vs dynamic friction).

Forces applied by the Wheels cause the Velocty of Car and the Rate Angle of Car is Changing to change. You then advance the simulation, and recalculate forces.

How the physics simulation is done (how you calculate forces and the effects of forces) is the interesting part. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this