"Arcade" style Car Physics

Hi All!

I’m making a race game, and as a starting point I used the Car.js script that comes with the Unity Car Tutorial.

I’m trying to get the car to jump more “arcade” style: It shouldn’t be able to flip, nor should it be able to continue drifting in mid air (when you hit the ramp while drifting the car can acturally do horizontal 360 degrees circles, like it’s still drifting.

I do have inclines in the tracks, so the car shouldn’t always be perfectly horizontal. The Car.js script takes it a bit too far though: The car can drive onto anything with an incline of about >89 degrees, it sticks to walls like a fly… Can this be part of the problem? Why the hell is this anyway? The cars rigid body weighs about 1500… I’ve checked the script a 1000 times, but there doesn’t seem to be anything in it pertaining to what I’m looking for…

How would I go about achieving this? Should I just make a bit of code that checks if the car is jumping, and then stabilize it, make sure it doesn’t flip over, and/or keeps drifting in mid air? Or is there another/better way?

Or should I perhaps dump the Car.js, and start off something new?

Thanks in advance!!

Thomas

Just adding my 2 cents - I did an arcade-ish style car awhile back and I stayed away from using the wheel colliders and example car physics all together. It didn’t seem very extensible and wheel colliders are also extremely expensive in their calculations (if you’re working towards mobile deployment it’s probably more of a concern than on desktop/web).

I came across the car script on this blog awhile back which I used and adapted to what I needed it to do. It uses raycasts for wheels, which I find are much more malleable than built-in wheel colliders.

I suggest giving that a shot - it might require some knowledge of what’s going on to really modify but like I said, it’s probably better in the long run for an arcade experience.

[Edit]

You can account for if the car is grounded by adding some logic to your wheels, if enough of them are currently on the ground. If it’s in the air, then you can apply some different physics logic to them where the orientation of the vehicle is controlled not by the wheels, but by custom forces, until it safely lands.

Also, for the whole “sticking to the wall like a fly” thing, I haven’t touched the car tutorial since it was released and I saw how unhelpful it was - but what I can assume is that it has something like a constant downward force relative to the car which keeps it from flying off the ground when driving.

Hope that helps.

==