This commit is contained in:
SoulliesOfficial
2025-10-23 00:49:44 -04:00
parent 9b1b5ca93f
commit 61a397dd4c
9846 changed files with 2618439 additions and 793547 deletions

View File

@@ -31,7 +31,9 @@ namespace MoreMountains.Tools
protected Vector3 _gizmoCenter;
protected Rigidbody _rigidbody;
#if MM_PHYSICS2D
protected Rigidbody2D _rigidbody2D;
#endif
/// <summary>
/// On Awake we grab our components and set our center of mass if needed
@@ -63,7 +65,9 @@ namespace MoreMountains.Tools
protected virtual void Initialization()
{
_rigidbody = this.gameObject.MMGetComponentNoAlloc<Rigidbody>();
#if MM_PHYSICS2D
_rigidbody2D = this.gameObject.MMGetComponentNoAlloc<Rigidbody2D>();
#endif
}
/// <summary>
@@ -76,10 +80,12 @@ namespace MoreMountains.Tools
_rigidbody.centerOfMass = CenterOfMassOffset;
}
#if MM_PHYSICS2D
if (_rigidbody2D != null)
{
_rigidbody2D.centerOfMass = CenterOfMassOffset;
}
#endif
if (AutoDestroyComponentAfterSet)
{