- Home /
Upgrading to Unity 5 messed up my Rigidbody Center of masses
Hello!
I recently upgraded my Unity to Unity 5 and with it the Rigidbodies changed to GetComponent.
Now my rigidbody center of masses are messed up. :(
Vector3 temp = GetComponent<Rigidbody>().centerOfMass;
temp.y = 0f;
GetComponent<Rigidbody>().centerOfMass = temp;
What do you mean by "messed up?" What is wrong with the center of mass?
$$anonymous$$y car seems to be kind of "floating" and not s$$anonymous$$dy at all. It is not stationary on the ground but rather looking like an inflatable bouncing castle.
Did anybody have similar issues when upgrading to Unity 5?
Not explicitly with centre of mass but, yes, I have a physics-heavy project that didn't upgrade nicely to 5.x. The Unity car tutorial doesn't either.
I would personally never recommend anyone upgrade Unity versions midway through a project...
Answer by RLin · May 10, 2015 at 07:15 PM
The problem isn't your center of mass, it's that your rigidbody doesn't have enough mass. Unity 5 wheelcolliders require realistic values to function correctly. Your car is only 300kg; a real car is generally not too far above or below 1500kg. Using mass values that are too low is causing the bouncing.
Same problem occurs with 1500.
$$anonymous$$y wheel colliders look like this. Increasing the mass to 100 and 1000 didn't solve the problem.
Your suspension spring is way too low; the default values of 35000 spring should be used. $$anonymous$$eep the rigid body mass at 1500, change all the springs to 35000 spring and 6400 damper, and see what happens.
Well now it just looks ridiculous, but I think that we are going in the right direction!
You can change the local y position of the wheelcolliders, and how far they extend downward so that it won't look "ridiculous."
Your answer
Follow this Question
Related Questions
RigidBody immediately stops after AddForce 1 Answer
the object of type rigidbody has been destroyed 3 Answers
How does instantiate connect to rigidbody?,How does instantiate userigidbody without getcomponent? 1 Answer
How can I pragmatically move a navmesh rigid body when changing scenes? 0 Answers
Rigidbody player keeps moving after AddForce has stopped? 3 Answers