fzzr
1
Is there a way to set the origin of the local coordinate system of a `rigidbody` equal to the `centerOfMass` automatically calculated by the Unity engine for a `MeshCollider` or complex of primitives?
I don't want to arbitrarily set the `centerOfMass`, since I want to use the auto-calculated one, but I want to apply rotational forces relative to the `centerOfMass`.
I'm using `addRelativeTorque` to apply rotational forces.
Thank you for your time, please ask me to clarify if necessary.
You could add an intermediate transform to act as an offsetter. E.g.
var offsetter = GameObject(transform.name + "Offsetter");
offsetter.transform.position = transform.TransformPoint(rigidbody.centerOfMass);
offsetter.transform.rotation = transform.rotation;
offsetter.transform.parent = transform.parent;
transform.parent = offsetter.transform;