Feel  3.16
The best way to improve your game's feel and make it extra juicy
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 { AutomaticSetModes.Awake, AutomaticSetModes.Start, AutomaticSetModes.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 More...
 

Public Attributes

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

Protected Member Functions

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

Protected Attributes

Vector3 _gizmoCenter
 
Rigidbody _rigidbody
 
Rigidbody2D _rigidbody2D
 

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

◆ _rigidbody2D

Rigidbody2D MoreMountains.Tools.MMRigidbodyCenterOfMass._rigidbody2D
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: