Game Development Community

Top-down vehicle physics

by Joe Bourrie · in Torque Game Builder · 09/19/2005 (5:08 pm) · 3 replies

I am making a top-down view game where I need driveable cars and other vehicles with realistic physics on them. Collision response is easy, but I also need the physics to handle their grip on the road.

On a real car, the frictional force with the ground is much higher when sliding sideways, because the tires don't roll that way. I want to do this same thing with my cars in the game.

- setDamping() will set a damping "friction-like" force that would "emulate" friction, but it is axis-independent and not very flexible, so I think this is wrong.

- As I understand it, friction will only apply when two objects are colliding. In this circumstance, the two objects (car and ground) are always colliding, because it is a top-down view. Should I make a world-sized object that can be penetrated during collision, so that the cars are always colliding with it, or is there a better way?

The other question is: what would be the best way to get that two-axis friction effect (wheels roll forward, but catch if they try to slide)?


Thanks,
Joe Bourrie

#1
09/19/2005 (6:59 pm)
This is not something that there is a physics mode in T2D that you can just turn on. The physics in T2D is based on 2D rigid bodies, whereas you're emulating something else entirely. So you're going to have to code it yourself. You're going to have to, every tick, get the car's position, orientation, and velocity, and do some physics computations to figure out what it's next orientation and velocity should be (let the simulation handle position). You'll probably have to handle collision responses physics yourself too, just to make things consistent with your physics.

That being said, T2D may actually have tools to help you. For example, it may expose the ability to "hang" one or more forces off of an object. At which point, all you need to do is determine what the extra car forces should be and simply add them to the object in the simulation. Using this method, you can probably still use the T2D collision response.
#2
09/19/2005 (8:58 pm)
Ok, thanks. Just started with T2D and wasn't sure just how flexible the physics system was.
#3
09/21/2005 (5:36 pm)
If you actually want realistic car physics it gets rather more complicated than your simple example (tire rolling vs lateral skid). I dug up a lot of the relevant information but its not fresh in my head because my own car combat game has been on hold for some months now (reimplementing core objects in C++ rather than script to insure performance is mostly done, but the fun had started to leave so I picked up a simpler project)

The point being I'd be happy to correspond with you about car physics in T2D