|
Inventory Engine v4.2
|
Use this script to have a Transform automatically face a certain direction, whether its own movement direction, or a specific target Transform. More...
Inherits MonoBehaviour.
Public Types | |
| enum | UpdateModes { Update , LateUpdate , FixedUpdate } |
| the possible Updates this script should run at More... | |
| enum | ForwardVectors { Forward , Up , Right } |
| the vector to point towards the direction More... | |
| enum | FacingModes { MovementDirection , 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 | |
| Transform | FacingTarget |
| the target to face | |
| float | MinimumMovementThreshold = 0.2f |
| the minimum distance to consider when computing the movement direction | |
| ForwardVectors | ForwardVector = ForwardVectors.Forward |
| the vector to point towards the direction | |
| Vector3 | DirectionRotationAngles = Vector3.zero |
| the angles by which to rotate the direction (in degrees) | |
| bool | LockXAxis = false |
| bool | LockYAxis = false |
| bool | LockZAxis = false |
| UpdateModes | UpdateMode = UpdateModes.LateUpdate |
| the possible Updates this script should run at | |
| float | InterpolationSpeed = 0.15f |
| the speed at which to interpolate the rotation | |
Protected Member Functions | |
| virtual void | Awake () |
| On Awake we initialize our behaviour. | |
| virtual void | Initialization () |
| Caches upwards vector and transform. | |
| virtual void | FaceDirection () |
| Computes the direction to face. | |
| virtual void | ApplyRotation () |
| Rotates the transform. | |
| virtual void | Update () |
| On Update we compute our direction if needed. | |
| virtual void | LateUpdate () |
| On LateUpdate we compute our direction if needed. | |
| virtual void | FixedUpdate () |
| On FixedUpdate we compute our direction if needed. | |
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.
|
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