Feel  5.2
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.MMFaceDirection Class Reference

Use this script to have a Transform automatically face a certain direction, whether its own movement direction, or a specific target Transform More...

Inheritance diagram for MoreMountains.Tools.MMFaceDirection:

Public Types

enum  UpdateModes { UpdateModes.Update, UpdateModes.LateUpdate, UpdateModes.FixedUpdate }
 the possible Updates this script should run at More...
 
enum  ForwardVectors { ForwardVectors.Forward, ForwardVectors.Up, ForwardVectors.Right }
 the vector to point towards the direction More...
 
enum  FacingModes { FacingModes.MovementDirection, FacingModes.Target }
 whether to point at this transform's movement direction, or at a target More...
 

Public Attributes

FacingModes FacingMode = FacingModes.MovementDirection
 whether to point at this transform's movement direction, or at a target More...
 
Transform FacingTarget
 the target to face More...
 
float MinimumMovementThreshold = 0.2f
 the minimum distance to consider when computing the movement direction More...
 
ForwardVectors ForwardVector = ForwardVectors.Forward
 the vector to point towards the direction More...
 
Vector3 DirectionRotationAngles = Vector3.zero
 the angles by which to rotate the direction (in degrees) More...
 
bool LockXAxis = false
 
bool LockYAxis = false
 
bool LockZAxis = false
 
UpdateModes UpdateMode = UpdateModes.LateUpdate
 the possible Updates this script should run at More...
 
float InterpolationSpeed = 0.15f
 the speed at which to interpolate the rotation More...
 

Protected Member Functions

virtual void Awake ()
 On Awake we initialize our behaviour More...
 
virtual void Initialization ()
 Caches upwards vector and transform More...
 
virtual void FaceDirection ()
 Computes the direction to face More...
 
virtual void ApplyRotation ()
 Rotates the transform More...
 
virtual void Update ()
 On Update we compute our direction if needed More...
 
virtual void LateUpdate ()
 On LateUpdate we compute our direction if needed More...
 
virtual void FixedUpdate ()
 On FixedUpdate we compute our direction if needed More...
 

Protected Attributes

Vector3 _direction
 
Vector3 _positionLastFrame
 
Transform _transform
 
Vector3 _upwards
 
Vector3 _targetPosition
 

Detailed Description

Use this script to have a Transform automatically face a certain direction, whether its own movement direction, or a specific target Transform

Member Enumeration Documentation

◆ FacingModes

whether to point at this transform's movement direction, or at a target

Enumerator
MovementDirection 
Target 

◆ ForwardVectors

the vector to point towards the direction

Enumerator
Forward 
Up 
Right 

◆ UpdateModes

the possible Updates this script should run at

Enumerator
Update 
LateUpdate 
FixedUpdate 

Member Function Documentation

◆ ApplyRotation()

virtual void MoreMountains.Tools.MMFaceDirection.ApplyRotation ( )
protectedvirtual

Rotates the transform

◆ Awake()

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

On Awake we initialize our behaviour

◆ FaceDirection()

virtual void MoreMountains.Tools.MMFaceDirection.FaceDirection ( )
protectedvirtual

Computes the direction to face

◆ FixedUpdate()

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

On FixedUpdate we compute our direction if needed

◆ Initialization()

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

Caches upwards vector and transform

◆ LateUpdate()

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

On LateUpdate we compute our direction if needed

◆ Update()

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

On Update we compute our direction if needed

Member Data Documentation

◆ _direction

Vector3 MoreMountains.Tools.MMFaceDirection._direction
protected

◆ _positionLastFrame

Vector3 MoreMountains.Tools.MMFaceDirection._positionLastFrame
protected

◆ _targetPosition

Vector3 MoreMountains.Tools.MMFaceDirection._targetPosition
protected

◆ _transform

Transform MoreMountains.Tools.MMFaceDirection._transform
protected

◆ _upwards

Vector3 MoreMountains.Tools.MMFaceDirection._upwards
protected

◆ DirectionRotationAngles

Vector3 MoreMountains.Tools.MMFaceDirection.DirectionRotationAngles = Vector3.zero

the angles by which to rotate the direction (in degrees)

◆ FacingMode

FacingModes MoreMountains.Tools.MMFaceDirection.FacingMode = FacingModes.MovementDirection

whether to point at this transform's movement direction, or at a target

◆ FacingTarget

Transform MoreMountains.Tools.MMFaceDirection.FacingTarget

the target to face

◆ ForwardVector

ForwardVectors MoreMountains.Tools.MMFaceDirection.ForwardVector = ForwardVectors.Forward

the vector to point towards the direction

◆ InterpolationSpeed

float MoreMountains.Tools.MMFaceDirection.InterpolationSpeed = 0.15f

the speed at which to interpolate the rotation

◆ LockXAxis

bool MoreMountains.Tools.MMFaceDirection.LockXAxis = false

◆ LockYAxis

bool MoreMountains.Tools.MMFaceDirection.LockYAxis = false

◆ LockZAxis

bool MoreMountains.Tools.MMFaceDirection.LockZAxis = false

◆ MinimumMovementThreshold

float MoreMountains.Tools.MMFaceDirection.MinimumMovementThreshold = 0.2f

the minimum distance to consider when computing the movement direction

◆ UpdateMode

UpdateModes MoreMountains.Tools.MMFaceDirection.UpdateMode = UpdateModes.LateUpdate

the possible Updates this script should run at


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