- Home /
centerOfMass not in edit mode?
Hi, I'm just wondering why it isn't possible to set centerOfMass in edit mode? Having a prefab with the centerOfMass already set would have been better than having to set it every time the prefab is Instantiated.
Is it possible to somehow get it to show up in the inspector?
Answer by Joshua · Apr 28, 2011 at 02:20 PM
It's possible with a little workaround. Create an empty gameobject (name it CenterOfMass for clarity) and add a rigidbody to it.
Parent this to the actual object you want to set the center of mass on. Put it in the position of where you'd like the center of mass to be.
Now set the weight of the parent to zero and the weight of the CenterOfMass to the weight of the parent.
Answer by Kourosh · Apr 28, 2011 at 08:16 AM
Yes,
Define variable of Vector3 and set the centerOfGravity equal to the variable.
Won't that only work for gravity, and not other physics simulations?