Physics engine or DIY?

Started by
11 comments, last by Hodgman 10 years, 6 months ago

I'm working on a racing game with realistic racing car physics that's all custom written, however I still use off the shelf physics engines for everything except for the tyres/sprints/aerodynamics wink.png The rigid body simulation and collision detection frameworks from existing engines are still extremely handy, meaning I just have to add some extra forces into the sim and it all works out of the box.

Do you mind if I briefly hijack this thread to ask what sort of collision resolution methods work well for racing games? Particularly given you need incredibly smooth movement over terrain...

Advertisement


Do you mind if I briefly hijack this thread to ask what sort of collision resolution methods work well for racing games? Particularly given you need incredibly smooth movement over terrain...

I don't know about Hodgman's approach, but the most widely used and easiest to implement seems to be the raycasting model. Shoot a ray from the wheel hub downwards to find the contact point, compute forces based on the suspension spring/dampening, steering, wheel rpm, slip angle, tire model, etc. you can get as crazy as you like.

Sorry I forgot to reply, but yeah, what Madhed said ^^^ biggrin.png

I use a trimesh for the race track, even though curves would be ideal, just because the art packages and the physics middleware support them. In areas where the slope of the track changes, if you use a decent number of polygons then it feels smooth.

The body of the car itself is a regular rigid body as supported by the physics middleware. The results of the raycasting are used to do all the wheel/tyre/suspension/transmission/engine/etc calculations, which then apply forces to the body. Soft tyres and suspension will absorb the small bumps from the trimesh, just like in real life wink.png If your tri-mesh is too bumpy though, it also affects the handling/traction of the car though, also just like real life.

This topic is closed to new replies.

Advertisement