Hello all, I am currently building a cartoon racing game in which the player has the ability to ‘jump’ to avoid rockets and such. In Unity 4.6, this was achieved by simply applying an upwards force on the car’s Rigidbody, however, in Unity 5, the car is not stable when it jumps, and will roll midair if the player attempts to jump while turning. I believe the problem may be related to the new suspension system of the WheelColliders in Unity 5, which I finally got to work well enough.
This is what I used to jump in Unity 4.6:
function Jump () {
if (wheelRL.isGrounded || wheelRR.isGrounded) {
if (RebindableInput.GetKeyDown("Jump") || RebindableInput.GetKeyDown("JumpSecondary")) {
GetComponent.<Rigidbody>().AddRelativeForce(0, JumpSpeed, 0);
}
}
}
I have attached screenshots of the Rigidbody and WheelCollider settings and values. Any help is much appreciated, I have been trying to make this simple feature work in Unity 5 for far too long.
Unfortunately, changing the velocity produces pretty much the same result. Here are some videos of the project in action, I hope to clarify what the exact problem is. The car tumbles in Unity 5, and the WheelColliders are pretty much the only change. Thanks for any help you can offer!
The CG is shifted downwards by 0.3, but that is all. I have also tried various implementations of the ForceAtPosition, however all of them produce the same, or some such variation of the same results. The car doesn’t just bounce up nicely like it used to. I have a feeling it it the suspension system, since I used the new WheelCollider suspension in Unity 5, and had no such suspension in Unity 4. Can I somehow make the wheel suspension have less of an effect on the rigidbody’s tilt, would that even help? It works fine in Unity 5 when all wheels are fully compressed and the car is stationary, but when motion is involved, it just tumbles. Let me know if you have any other ideas…
That does seem to do the trick, however, sometimes the angular drag will not change when it jumps or when it touches the ground again. I may just use Trigger colliders for that instead of wheel.isGrounded. Thanks for all your help!