Car physics?

Anyone know of an existing framework for simulating car physics in Java? Would love to see some code if there’s any out there.

I once started out to try things like that. My basic idea was to reduce coordinate space from 3D to 2D, or sometimes even 1.5D.

This could make pyhsics easier, or more complicated, I didn’t get that far.

There’s a small demo at

http://www.hardcode.de/driver.html

It shows a ‘car’ that keeps on track while it’s coordinates increase monotonously in u direction and sinus in v direction.

Some linear algebra behind it…

First hit on Google for ‘java car physics’: http://www.cs.uni-magdeburg.de/~sodeike/java/CarPhysics/CarPhysics.html

/M

Micke: I found the link with more info that generated that code.

http://home.planet.nl/~monstrous/tutcar.html

Also, by taking off the CarPhysics.html from the URL I got to the java source. It’s a decent start. Adjusting the CG forward a bit (see below) made the car more stable and more realistic. The default settings go into oversteer almost immediately as soon as you turn(which makes sense given there is no suspension at all).

    cartype.b = 0.9;                               // m
    cartype.c = 1.1;                               // m

// cartype.b = 1.0; // m
// cartype.c = 1.0; // m

Thanks :slight_smile:

Actually found a really good and detailed series of articles which should really help :slight_smile:

http://phors.locost7.info/contents.htm

Shameless plug:

http://website.lineone.net/~john.montgomery/RacingGame/

Really simple racing game, source code is there. The physics is basic 2D rigid body stuff. Internally the “cars” are more like hovercraft (in terms of how friction is handled). The networking really sucks tho!

John