# Physics for wipeout-like game

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

## Recommended Posts

Hello. This is a problem I haven't been able to solve 'perfectly' for a long time. Basically, I want to implement some basic arcade vehicle physics for a game similar to Wipeout, featuring tracks with slopes. The vehicles are hovercrafts, hovering over the surface of the road. I tried to implement raycast car such as this:

For every 'imaginary wheel'(usually at the 4 corners of the vehicle):

1)Perform a raycast and find the distance to the ground
2)Calculate a spring force, damped by some factor
3)Apply the force to the wheel position.

This is how it's done, right? Regardless, I can't achieve perfectly smooth motion on slopes, the vehicle either noticably 'jitters' when the spring is too hard or, on the other hand, takes too long to "conform" to the slope, so to speak, if the dampening is too much.

Am I missing something here? If anyone has some pseudo-code on how it's properly done I would be greatful. Thanks!

##### Share on other sites

Hello. This is a problem I haven't been able to solve 'perfectly' for a long time. Basically, I want to implement some basic arcade vehicle physics for a game similar to Wipeout, featuring tracks with slopes. The vehicles are hovercrafts, hovering over the surface of the road. I tried to implement raycast car such as this:

For every 'imaginary wheel'(usually at the 4 corners of the vehicle):

1)Perform a raycast and find the distance to the ground
2)Calculate a spring force, damped by some factor
3)Apply the force to the wheel position.

This is how it's done, right? Regardless, I can't achieve perfectly smooth motion on slopes, the vehicle either noticably 'jitters' when the spring is too hard or, on the other hand, takes too long to "conform" to the slope, so to speak, if the dampening is too much.

Am I missing something here? If anyone has some pseudo-code on how it's properly done I would be greatful. Thanks!

I can't think of a "proper" solution for this, since (i assume) your "slopes" are not actual slopes, but a collection of triangles.
You could always perform a cheat-solution, and set the new rotation as:
 final_rotation = Quaternion.lerp(old_rotaion, new_rotation, alpha) 

Where alpha is a user-defined real number in range of 0 < alpha < 1. The higher the number, the smoother the transition. This could however result in too slow rotations in cases where you would actually need a really sharp one.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5
A4L
12

• 11
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633723
• Total Posts
3013541
×