Jump to content
  • Advertisement
Brunni

Arcade car physics

Recommended Posts

Advertisement

Btw, I was thinking about making another post about the spring physics, but I'm puzzled about something. For now I use raycasts to keep the car off the ground from a certain target distance, based on what I described in my previous entry.

Now I adjusted the spring stiffness and rest position so that the car drops out if there's either a significant upward impulse, or if there's a sharp bump. Too stiff (& damped) and the car will stick to the ground no matter what, too soft and it'll take off with only the bounce after landing.

But this seems fundamentally wrong, as with this approach, the car will stick to the ground even upside down. That is, unless you make the spring soft enough so that the gravity force is stronger than the force that the spring has to bring the car back to the ground.

Am I missing something?

 

 

Share this post


Link to post
Share on other sites
8 hours ago, Brunni said:

But this seems fundamentally wrong, as with this approach, the car will stick to the ground even upside down. That is, unless you make the spring soft enough so that the gravity force is stronger than the force that the spring has to bring the car back to the ground.

You're saying your spring, when extended beyond its rest length, will pull the car into the ground?

In a real sim, the spring is basically connected to the tyre and the chassis. When the spring tries to return to its rest length, it pulls both of them closer together. Ignoring gravity, the ground, etc, then the relative motion of each depends on their mass. If the tyre is light and the chassis is heavy, then the chassis will only be slightly moved while the tyre will move a lot. The chassis won't get pulled into the ground; the wheels will get pulled away from the ground!

In a less realistic sim, you could have tyres with zero mass, in which case the chassis-end of the spring wouldn't move at all, and only the wheel-end of the spring would move.

The situation where the spring is compressed to be shorter than its rest length (because the car is sitting on the ground) is a little different, because when the spring tries to push the wheel away from the chassis, the wheel pushes against the ground, which we're pretending is immovable (infinite mass)... So in that situation, when the spring ties to extend, the only end of the sprite that is able to move is the chassis-connected end. 

Share this post


Link to post
Share on other sites
On ‎11‎/‎27‎/‎2018 at 9:08 PM, Brunni said:

Now I adjusted the spring stiffness and rest position so that the car drops out if there's either a significant upward impulse, or if there's a sharp bump. Too stiff (& damped) and the car will stick to the ground no matter what, too soft and it'll take off with only the bounce after landing.

Are you sure about the terms? What you described it should behave the other way around: soft = stick to ground, stiff = bouncy

Technically: soft -> k = small number, stiff -> k = large number  (k=spring stiffness)

 

On ‎11‎/‎27‎/‎2018 at 9:08 PM, Brunni said:

But this seems fundamentally wrong, as with this approach, the car will stick to the ground even upside down.

Are you applying spring forces "upwards" in global space or in the car's local frame?

 

Also it seems you found one of the funniest problem with high speed driving (sharp bumps);
If you are moving fast the car will move too much between two simulation steps. If you are stuck to the traditional 60Hz physics update and your car is moving at 200km/h, that means the wheel moves about one meter (!) between two frames. Even with not much bend in the road surface that could cause the wheel to sink 30-40cm underground, meaning a huge upwards spring force.

 

Out of curiosity what are your spring values? I'd see something around 30-50K for a sports car and 200-250K for a formula 1 car.

Edited by bmarci

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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!