Hello!
After a long time I’ve finally made a decision to update onto newest version of Unity, mainly because of Unity 6 update.
Everything seems pretty fine, but I’ve noticed unpleasant bug that wasn’t in the previous version.
Explanation:
After starting the game, everything seems fine, cars drive nice and straight. Everything starts after turning left or right. As you can see on the video, the car uncontrollably starts to move onto side, hovewer the rotation of the car is exactly set and there is no problem with the car.
Also, after pausing and unpausing the game, everything becomes alright and car is driving straight again.
Sounds like a bug! From the description of pause/unpause fixing it, perhaps some of your code inadvertently depends on script execution order and you’ve been lucky all this time.
Either way it is definitely high time to start debugging!
By debugging you can find out exactly what your program is doing so you can fix it.
Use the above techniques to get the information you need in order to reason about what the problem is.
You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.
Once you understand what the problem is, you may begin to reason about a solution to the problem.
Yeah, that’s why I showed the rotation of the vehicle.
The script maitains only rotation of car (it is fixed, because the car is going exactly straight after turning) and rotation of the wheels, they are straight aswell, and also the car is not turning only with front, it just slides to the side, so I don’t consider it as a bug in my script for cars.
I suppose with that framing your hands are kinda tied… I guess unless and until all these things are true:
a) it really is a Unity 6 bug that (somehow) nobody else has noticed yet
b) you identify and report the bug well enough that Unity can reproduce it
c) Unity fixes it
Since car driving games are successfully done all the time in Unity, you may wish to push around this problem and come up with a new way to accomplish your goals.
Or just try debugging to find out what is going wrong with what you’ve got.
Hello!
After inspection i’ve found some new info about this problem.
Firstly I tried various older versions of Unity, where I found out, that the problem started when Unity added Center of Mass setting into Rigidbody setting in editor.
My project was developed on ver. 2020.3.5f1. 2021.3.45f1 that I tried works great aswell, but on version 2022.3.51f1 I ran into the same problem, because this version contains new Center of Mass settings, so it’s not only problem in the latest Unity 6 version.
Also during debugging session I’ve found out, that not only pausing and unpausing game fixes the problem, but also editing rigidbody setting (Mass, Center of mass…) makes it act as expected.
Video link: Unity - Car physics bug?
In the video you can see as the car starts to slide onto left side after turning left (look at Z coordinate).
After playing with Center Of Mass setting, the car fixes itself and continues straight.
I guess it’s still not enough to find out where the problem is, but maybe someone experienced the same problem and will be able to help
My last resort is freezing the coordinate, but I guess it would be better to resolve this problem for better collisions between player and cars.
After setting Rigidbidy’s interpolation to “None”, everything works fine
It’s strange that this “bug?” is in Unity since 2022, but I definitely consider it as a bug, because it fixes itself just by pausing the game or changing rigidbidy settings as I showed in the video above, anyway is there any chance of fixing? I’d love to use interpolation again.
Thanks!
Conditions for reproduction of the bug:
Use Unity version 2022 or newer
Set your car’s rigidbody to “Interpolate” or “Extrapolate”
Make it drive straight and then turn left or right by script (90 degrees)
(After turning left the car slides onto left side, after turning right the car slides onto right side)
I’m aware there’s problems with Interpolation/Extrapolation at the moment and they are on my plate to handle, so having more failure cases would help raise the prio on this!