Arcade car physics

Started by
23 comments, last by bmarci 5 years, 4 months ago

Thanks for the link! I'll definitely check that out after I'm done with what I'm doing not (which is not physics).

Some progress:

 

CarGame-v6.mp4
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?

 

 

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. 

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.

This topic is closed to new replies.

Advertisement