# How to simulate a 4-wheel vehicle?

This topic is 4917 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How to simulate a 4-wheel vehicle moving on the bumpy ground? I want that the Vehicle can move on a bumpy ground and the body of vehicle swing with the bumpy ground.

##### Share on other sites
A typical method would be to treat the wheels as 4 cylinders, which are constrained so that if they are intersecting some geometry, they are pushed out. You would then go about colliding the 4 cylinders with the geometry of the floor.

One problem with this method is that if the floor geometry is overly detailed, you could be doing needless tests. You can help prevent this by having a simplified version of the geometry for doing floor collisions, or just not using highly detailed geometry on parts of the map that the vehicle can drive on.

Another method could be used if you are using some sort of height map. You could simply read the minimum height of the wheels from the heightmap, based on their current positions, and then constrain them from going lower than that height.

For the vehicle body, you could simply use a rectangluar collision object, and collide with other geometry using the box. You may want a slightly more detailed collision object if you wish to be able to flip the vehicle on its back though.

##### Share on other sites
rays cast for each wheel, contacts made with high friction [acting as suspension and tires], and anti-roll techniques [torque applied when turning to keep wheels on ground]

doing a test with a cylinder is much more difficult to tweak to run reasonably, and has realistic but annoying issues like curbs could tip your vehicle if you slide into them.

this is an implementation of the above ideas in ODE
http://www.mindcontrol.org/~hplus/carworld.html

what I wonder is, is it reasonable to still use one ray when the wheels are massive [monster truck wheels?]

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634135
• Total Posts
3015753
×