Jump to content
  • Advertisement
Sign in to follow this  
mikeman

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!