1 2 3 4 5 6 7 8 9 10 11 12 13 14
using UnityEngine; public class CenterOfMass : MonoBehaviour { private void Start() { Rigidbody componentInParent = GetComponentInParent<Rigidbody>(); componentInParent.centerOfMass = componentInParent.transform.InverseTransformPoint(base.transform.position); } private void Update() { } }