Files
2026-03-04 10:03:45 +08:00

22 lines
420 B
C#

using UnityEngine;
namespace UltimateWater
{
public sealed class CenterOfMass : MonoBehaviour
{
public void Apply()
{
Rigidbody componentInParent = GetComponentInParent<Rigidbody>();
if (componentInParent != null)
{
componentInParent.centerOfMass = componentInParent.transform.worldToLocalMatrix.MultiplyPoint3x4(base.transform.position);
}
}
private void OnEnable()
{
Apply();
}
}
}