Feel 5.9.1
The best way to improve your game's feel and make it extra juicy
Loading...
Searching...
No Matches
MoreMountains.Tools.MMRigidbodyCenterOfMass Class Reference

Add this class to a Rigidbody or Rigidbody2D to be able to edit its center of mass from the inspector directly. More...

Inheritance diagram for MoreMountains.Tools.MMRigidbodyCenterOfMass:

Public Types

enum  AutomaticSetModes { Awake , Start , ScriptOnly }
 the possible modes this class can start on More...

Public Member Functions

virtual void SetCenterOfMass ()
 Sets the center of mass on the rigidbody or rigidbody2D.

Public Attributes

Vector3 CenterOfMassOffset
 the offset to apply to the center of mass
AutomaticSetModes AutomaticSetMode = AutomaticSetModes.Awake
 whether to set the center of mass on awake, start, or via script only
bool AutoDestroyComponentAfterSet = true
 whether or not this component should auto destroy after a set
float GizmoPointSize = 0.05f
 the size of the gizmo point to display at the center of mass
bool SetCenterOfMassButton
 a button to test the set method

Protected Member Functions

virtual void Awake ()
 On Awake we grab our components and set our center of mass if needed.
virtual void Start ()
 On Start we set our center of mass if needed.
virtual void Initialization ()
 Grabs the rigidbody or rigidbody2D components.
virtual void OnDrawGizmosSelected ()
 On DrawGizmosSelected, we draw a yellow point at the position of our center of mass.

Protected Attributes

Vector3 _gizmoCenter
Rigidbody _rigidbody

Detailed Description

Add this class to a Rigidbody or Rigidbody2D to be able to edit its center of mass from the inspector directly.

Member Enumeration Documentation

◆ AutomaticSetModes

the possible modes this class can start on

Enumerator
Awake 
Start 
ScriptOnly 

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.MMRigidbodyCenterOfMass.Awake ( )
protectedvirtual

On Awake we grab our components and set our center of mass if needed.

◆ Initialization()

virtual void MoreMountains.Tools.MMRigidbodyCenterOfMass.Initialization ( )
protectedvirtual

Grabs the rigidbody or rigidbody2D components.

◆ OnDrawGizmosSelected()

virtual void MoreMountains.Tools.MMRigidbodyCenterOfMass.OnDrawGizmosSelected ( )
protectedvirtual

On DrawGizmosSelected, we draw a yellow point at the position of our center of mass.

◆ SetCenterOfMass()

virtual void MoreMountains.Tools.MMRigidbodyCenterOfMass.SetCenterOfMass ( )
virtual

Sets the center of mass on the rigidbody or rigidbody2D.

◆ Start()

virtual void MoreMountains.Tools.MMRigidbodyCenterOfMass.Start ( )
protectedvirtual

On Start we set our center of mass if needed.

Member Data Documentation

◆ _gizmoCenter

Vector3 MoreMountains.Tools.MMRigidbodyCenterOfMass._gizmoCenter
protected

◆ _rigidbody

Rigidbody MoreMountains.Tools.MMRigidbodyCenterOfMass._rigidbody
protected

◆ AutoDestroyComponentAfterSet

bool MoreMountains.Tools.MMRigidbodyCenterOfMass.AutoDestroyComponentAfterSet = true

whether or not this component should auto destroy after a set

◆ AutomaticSetMode

AutomaticSetModes MoreMountains.Tools.MMRigidbodyCenterOfMass.AutomaticSetMode = AutomaticSetModes.Awake

whether to set the center of mass on awake, start, or via script only

◆ CenterOfMassOffset

Vector3 MoreMountains.Tools.MMRigidbodyCenterOfMass.CenterOfMassOffset

the offset to apply to the center of mass

◆ GizmoPointSize

float MoreMountains.Tools.MMRigidbodyCenterOfMass.GizmoPointSize = 0.05f

the size of the gizmo point to display at the center of mass

◆ SetCenterOfMassButton

bool MoreMountains.Tools.MMRigidbodyCenterOfMass.SetCenterOfMassButton

a button to test the set method


The documentation for this class was generated from the following file: