I want to make a topdown racing game, so I took 4 wheelcolliders and attached them to a rigidbody. After changing the forward friction stiffness to 0.01 the car accelerates at, what I feel as, the right speed and drives like a charm.
But it flips (quite) easily, which I absolutely don’t want. I’m already using Edy’s Antirollbar, but the only effect I get from them is that my car spins like a fan when it’s in the air. :-/
I also tried to constrain the x and z rotation of the rigidbody, but if I do that the car loses its drifting ability.
So, is there an easy to implement way to make a topdown racing car?
Since this is a top down racer I assume the ground at which the car is moving on is flat? If this is correct then all you need to do is define your car’s move direction and set it’s y position to 0. If you have hills or any uneven terrain/roads this will not work correctly. If you don’t know what I mean post your code and I can help you figure it out.
You need downforce.
Apply a constant force to the car rigidbody in the local -y direction that increases with the car’s speed.
If the car -does- flip, which it should be able to, catch that and turn the force off.
Have you figure it out? If not, check out the second pdf of the car tutorial. Right at the beginning the topic is taken care of.
You could try using this code for down force. (this is what i used to make a PERFECT car!):
Function FixedUpdate () {
rigidbody.AddForce(-transform.up * rigidbody.velocity.magnitude);
}
This code does have one problem though, and that;s that your car may end up sticking to walls like a fly…