TopDown Engine
v4.1
|
Use this script to have a Transform automatically face a certain direction, whether its own movement direction, or a specific target Transform More...
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 |
Use this script to have a Transform automatically face a certain direction, whether its own movement direction, or a specific target Transform
|
strong |
|
strong |
|
protectedvirtual |
Rotates the transform
|
protectedvirtual |
On Awake we initialize our behaviour
|
protectedvirtual |
Computes the direction to face
|
protectedvirtual |
On FixedUpdate we compute our direction if needed
|
protectedvirtual |
Caches upwards vector and transform
|
protectedvirtual |
On LateUpdate we compute our direction if needed
|
protectedvirtual |
On Update we compute our direction if needed
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Vector3 MoreMountains.Tools.MMFaceDirection.DirectionRotationAngles = Vector3.zero |
the angles by which to rotate the direction (in degrees)
FacingModes MoreMountains.Tools.MMFaceDirection.FacingMode = FacingModes.MovementDirection |
whether to point at this transform's movement direction, or at a target
Transform MoreMountains.Tools.MMFaceDirection.FacingTarget |
the target to face
ForwardVectors MoreMountains.Tools.MMFaceDirection.ForwardVector = ForwardVectors.Forward |
the vector to point towards the direction
float MoreMountains.Tools.MMFaceDirection.InterpolationSpeed = 0.15f |
the speed at which to interpolate the rotation
bool MoreMountains.Tools.MMFaceDirection.LockXAxis = false |
bool MoreMountains.Tools.MMFaceDirection.LockYAxis = false |
bool MoreMountains.Tools.MMFaceDirection.LockZAxis = false |
float MoreMountains.Tools.MMFaceDirection.MinimumMovementThreshold = 0.2f |
the minimum distance to consider when computing the movement direction
UpdateModes MoreMountains.Tools.MMFaceDirection.UpdateMode = UpdateModes.LateUpdate |
the possible Updates this script should run at