From 6ce8b9e22fc13be34b442c7b6af48b42cd44275a Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 13 Mar 2024 11:00:58 +0800 Subject: +init --- CenterOfMass.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 CenterOfMass.cs (limited to 'CenterOfMass.cs') diff --git a/CenterOfMass.cs b/CenterOfMass.cs new file mode 100644 index 0000000..9acb727 --- /dev/null +++ b/CenterOfMass.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +public class CenterOfMass : MonoBehaviour +{ + private void Start() + { + Rigidbody componentInParent = GetComponentInParent(); + componentInParent.centerOfMass = componentInParent.transform.InverseTransformPoint(base.transform.position); + } + + private void Update() + { + } +} -- cgit v1.1-26-g67d0