So I had some free time so I started playing around with this game engine I found called Unity3D. Long story short I started coding some car physics and then decided to make a “game” that used them… So here’s an afternoon’s worth of work.
I set it up with RS4 gear ratios, weight etc and it seems to be simulating somewhat right. I havn’t factored in a proper drag coefficient yet so that’s probably fudging things up a bit too. Tires are also probably too grippy. I’m still mucking with the Pacejka magic formula.
Standard controls. Up/Down for gas brake, space for handbrake, a/z for gears.
Disclaimers:
- The car tends to float forward at 0.01kph when stopped even if the brake is held so keep that in mind when staging.
- There are no tree lights so just go once you stage… the timers will start again automatically each time you leave the staging beam. - Holding the handbrake and tapping the gas helps with staging.
- There’s no clutch control yet, but the physics is set to “slip” the clutch at ~3800 RPM when in first gear.
- No ABS
- The power curve is extrapolated across three points for now. So torque will probably seem like it’s lacking lower down.
Have fun, ignore the sound and my volvo looking passoff for an RS4
You’ll need Unity Web Player (Sorry): http://unity3d.com/webplayer/
Results (csv file for now… I’ll make it look nicer or have an option to view it in game later on)
The neat thing about Unity is that it can do multiplatform deploys across PC, iPhone, Android and Web.
Who knows… maybe once I get the physics right I can polish it up, add some proper looking cars and maybe have some form of network play as well.
Change Log
v0.3.1 - 2012-10-05
Sound
v0.3.0 - 2012-10-04
Ability to upload results
v0.2.0 - 2012-10-04
Added Christmas Tree