Inventory Engine v4.2
Loading...
Searching...
No Matches
MoreMountains.Tools.MMAutoRotate Class Reference

Add this class to a GameObject to make it rotate on itself. More...

Inherits MonoBehaviour.

Public Types

enum  UpdateModes { Update , LateUpdate , FixedUpdate }

Public Member Functions

virtual void Rotate (bool status)
 Sets Rotating to true or false.
virtual void Orbit (bool status)
 Sets Orbiting to true or false.

Public Attributes

bool Rotating = true
 whether or not this object should be rotating right now
Space RotationSpace = Space.Self
 the space to apply the rotation in
UpdateModes UpdateMode = UpdateModes.Update
 whether movement should happen at Update, FixedUpdate or LateUpdate
Vector3 RotationSpeed = new Vector3(100f, 0f, 0f)
 The rotation speed. Positive means clockwise, negative means counter clockwise.
bool RandomizeRotationSpeed = false
 Whether or not the rotation speed should be randomized.
Vector3 RotationSpeedMin = new Vector3(100f, 0f, 0f)
 the minimum rotation speed to use if RandomizeRotationSpeed is true
Vector3 RotationSpeedMax = new Vector3(300f, 0f, 0f)
 the maximum rotation speed to use if RandomizeRotationSpeed is true
Vector2 RandomInitialDelay = Vector2.zero
 an offset, in seconds, to apply before starting the rotation, to allow for a delay
bool Orbiting = false
 if this is true, the object will also move around a pivot (only the position is affected, not the rotation)
bool AdditiveOrbitRotation = false
 if this is true, the orbit plane will rotate along with the parent
Transform OrbitCenterTransform
 the pivot to rotate around (if left blank, will be the object itself
Vector3 OrbitCenterOffset = Vector3.zero
 the pivot (relative to the object's position in local space) to rotate around
Vector3 OrbitRotationAxis = new Vector3(0f, 1f, 0f)
 the axis around which the object should rotate (don't make it zero)
float OrbitRotationSpeed = 10f
 the speed at which to rotate
float OrbitRadius = 3f
 the radius at which to orbit
float OrbitCorrectionSpeed = 10f
 the speed at which the object catches up when orbit radius or axis changes
bool DrawGizmos = true
 if this is true, will draw gizmos to show the plane, orbit and direction
Color OrbitPlaneColor = new Color(54f, 169f, 225f, 0.02f)
 the color of the orbit disc
Color OrbitLineColor = new Color(225f, 225f, 225f, 0.1f)
 the color of the orbit line
Vector3 _orbitCenter
Vector3 _worldRotationAxis
Plane _rotationPlane
Vector3 _snappedPosition
Vector3 _radius

Protected Member Functions

virtual void Start ()
 On start, we initialize our plane.
virtual void Update ()
 Makes the object rotate on its center at Update.
virtual void FixedUpdate ()
 Makes the object rotate on its center at FixedUpdate.
virtual void LateUpdate ()
 Makes the object rotate on its center at LateUpdate.
virtual void Rotate ()
 Rotates the object.

Protected Attributes

Quaternion _newRotation
Vector3 _desiredOrbitPosition
float _initialDelay = 0f
float _startTime = 0f

Detailed Description

Add this class to a GameObject to make it rotate on itself.

Member Enumeration Documentation

◆ UpdateModes

Enumerator
Update 
LateUpdate 
FixedUpdate 

Member Function Documentation

◆ FixedUpdate()

virtual void MoreMountains.Tools.MMAutoRotate.FixedUpdate ( )
protectedvirtual

Makes the object rotate on its center at FixedUpdate.

◆ LateUpdate()

virtual void MoreMountains.Tools.MMAutoRotate.LateUpdate ( )
protectedvirtual

Makes the object rotate on its center at LateUpdate.

◆ Orbit()

virtual void MoreMountains.Tools.MMAutoRotate.Orbit ( bool status)
virtual

Sets Orbiting to true or false.

Parameters
status

◆ Rotate() [1/2]

virtual void MoreMountains.Tools.MMAutoRotate.Rotate ( )
protectedvirtual

Rotates the object.

◆ Rotate() [2/2]

virtual void MoreMountains.Tools.MMAutoRotate.Rotate ( bool status)
virtual

Sets Rotating to true or false.

Parameters
status

◆ Start()

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

On start, we initialize our plane.

◆ Update()

virtual void MoreMountains.Tools.MMAutoRotate.Update ( )
protectedvirtual

Makes the object rotate on its center at Update.

Member Data Documentation

◆ _desiredOrbitPosition

Vector3 MoreMountains.Tools.MMAutoRotate._desiredOrbitPosition
protected

◆ _initialDelay

float MoreMountains.Tools.MMAutoRotate._initialDelay = 0f
protected

◆ _newRotation

Quaternion MoreMountains.Tools.MMAutoRotate._newRotation
protected

◆ _orbitCenter

Vector3 MoreMountains.Tools.MMAutoRotate._orbitCenter

◆ _radius

Vector3 MoreMountains.Tools.MMAutoRotate._radius

◆ _rotationPlane

Plane MoreMountains.Tools.MMAutoRotate._rotationPlane

◆ _snappedPosition

Vector3 MoreMountains.Tools.MMAutoRotate._snappedPosition

◆ _startTime

float MoreMountains.Tools.MMAutoRotate._startTime = 0f
protected

◆ _worldRotationAxis

Vector3 MoreMountains.Tools.MMAutoRotate._worldRotationAxis

◆ AdditiveOrbitRotation

bool MoreMountains.Tools.MMAutoRotate.AdditiveOrbitRotation = false

if this is true, the orbit plane will rotate along with the parent

◆ DrawGizmos

bool MoreMountains.Tools.MMAutoRotate.DrawGizmos = true

if this is true, will draw gizmos to show the plane, orbit and direction

◆ OrbitCenterOffset

Vector3 MoreMountains.Tools.MMAutoRotate.OrbitCenterOffset = Vector3.zero

the pivot (relative to the object's position in local space) to rotate around

◆ OrbitCenterTransform

Transform MoreMountains.Tools.MMAutoRotate.OrbitCenterTransform

the pivot to rotate around (if left blank, will be the object itself

◆ OrbitCorrectionSpeed

float MoreMountains.Tools.MMAutoRotate.OrbitCorrectionSpeed = 10f

the speed at which the object catches up when orbit radius or axis changes

◆ Orbiting

bool MoreMountains.Tools.MMAutoRotate.Orbiting = false

if this is true, the object will also move around a pivot (only the position is affected, not the rotation)

◆ OrbitLineColor

Color MoreMountains.Tools.MMAutoRotate.OrbitLineColor = new Color(225f, 225f, 225f, 0.1f)

the color of the orbit line

◆ OrbitPlaneColor

Color MoreMountains.Tools.MMAutoRotate.OrbitPlaneColor = new Color(54f, 169f, 225f, 0.02f)

the color of the orbit disc

◆ OrbitRadius

float MoreMountains.Tools.MMAutoRotate.OrbitRadius = 3f

the radius at which to orbit

◆ OrbitRotationAxis

Vector3 MoreMountains.Tools.MMAutoRotate.OrbitRotationAxis = new Vector3(0f, 1f, 0f)

the axis around which the object should rotate (don't make it zero)

◆ OrbitRotationSpeed

float MoreMountains.Tools.MMAutoRotate.OrbitRotationSpeed = 10f

the speed at which to rotate

◆ RandomInitialDelay

Vector2 MoreMountains.Tools.MMAutoRotate.RandomInitialDelay = Vector2.zero

an offset, in seconds, to apply before starting the rotation, to allow for a delay

◆ RandomizeRotationSpeed

bool MoreMountains.Tools.MMAutoRotate.RandomizeRotationSpeed = false

Whether or not the rotation speed should be randomized.

◆ Rotating

bool MoreMountains.Tools.MMAutoRotate.Rotating = true

whether or not this object should be rotating right now

◆ RotationSpace

Space MoreMountains.Tools.MMAutoRotate.RotationSpace = Space.Self

the space to apply the rotation in

◆ RotationSpeed

Vector3 MoreMountains.Tools.MMAutoRotate.RotationSpeed = new Vector3(100f, 0f, 0f)

The rotation speed. Positive means clockwise, negative means counter clockwise.

◆ RotationSpeedMax

Vector3 MoreMountains.Tools.MMAutoRotate.RotationSpeedMax = new Vector3(300f, 0f, 0f)

the maximum rotation speed to use if RandomizeRotationSpeed is true

◆ RotationSpeedMin

Vector3 MoreMountains.Tools.MMAutoRotate.RotationSpeedMin = new Vector3(100f, 0f, 0f)

the minimum rotation speed to use if RandomizeRotationSpeed is true

◆ UpdateMode

UpdateModes MoreMountains.Tools.MMAutoRotate.UpdateMode = UpdateModes.Update

whether movement should happen at Update, FixedUpdate or LateUpdate


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