Class SimpleInterpolator
A Unity component that interpolates a transform's position, rotation or scale.
Inheritance
Inherited Members
Namespace: IMLD.MixedRealityAnalysis.Utils
Assembly: Assembly-CSharp.dll
Syntax
public class SimpleInterpolator : MonoBehaviour
Properties
AnimatingLocalPosition
Gets a value indicating whether the transform's local position is animating.
Declaration
public bool AnimatingLocalPosition { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
AnimatingLocalRotation
Gets a value indicating whether the transform's local rotation is animating.
Declaration
public bool AnimatingLocalRotation { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
AnimatingLocalScale
Gets a value indicating whether the transform's scale is animating.
Declaration
public bool AnimatingLocalScale { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
AnimatingPosition
Gets a value indicating whether the transform's position is animating.
Declaration
public bool AnimatingPosition { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
AnimatingRotation
Gets a value indicating whether the transform's rotation is animating.
Declaration
public bool AnimatingRotation { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
PositionVelocity
Gets the velocity of a transform whose position is being interpolated.
Declaration
public Vector3 PositionVelocity { get; }
Property Value
| Type | Description |
|---|---|
| UnityEngine.Vector3 |
Running
Gets a value indicating whether the position, rotation or scale are animating.
Declaration
public bool Running { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
SmoothLerpToTarget
Gets or sets a value indicating whether the estimated targets lerp towards the object each update, slowing and smoothing movement.
Declaration
public bool SmoothLerpToTarget { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
SmoothPositionLerpRatio
Gets or sets the smoothness of the position lerp.
Declaration
public float SmoothPositionLerpRatio { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
SmoothRotationLerpRatio
Gets or sets the smoothness of the rotation lerp.
Declaration
public float SmoothRotationLerpRatio { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
SmoothScaleLerpRatio
Gets or sets the smoothness of the scale lerp.
Declaration
public float SmoothScaleLerpRatio { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
TargetLocalPosition
If animating position, specifies the target local position as specified by SetTargetPosition. Otherwise returns the current local position of the transform.
Declaration
public Vector3 TargetLocalPosition { get; }
Property Value
| Type | Description |
|---|---|
| UnityEngine.Vector3 |
TargetLocalRotation
If animating local rotation, specifies the target local rotation as specified by SetTargetLocalRotation. Otherwise returns the current local rotation of the transform.
Declaration
public Quaternion TargetLocalRotation { get; }
Property Value
| Type | Description |
|---|---|
| UnityEngine.Quaternion |
TargetLocalScale
If animating local scale, specifies the target local scale as specified by SetTargetLocalScale. Otherwise returns the current local scale of the transform.
Declaration
public Vector3 TargetLocalScale { get; }
Property Value
| Type | Description |
|---|---|
| UnityEngine.Vector3 |
TargetPosition
If animating position, specifies the target position as specified by SetTargetPosition. Otherwise returns the current position of the transform.
Declaration
public Vector3 TargetPosition { get; }
Property Value
| Type | Description |
|---|---|
| UnityEngine.Vector3 |
TargetRotation
If animating rotation, specifies the target rotation as specified by SetTargetRotation. Otherwise returns the current rotation of the transform.
Declaration
public Quaternion TargetRotation { get; }
Property Value
| Type | Description |
|---|---|
| UnityEngine.Quaternion |
Methods
NonLinearInterpolateTo(Vector3, Vector3, Single, Single)
Interpolates smoothly to a target position.
Declaration
public static Vector3 NonLinearInterpolateTo(Vector3 start, Vector3 target, float deltaTime, float speed)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | start | The starting position. |
| UnityEngine.Vector3 | target | The destination position. |
| System.Single | deltaTime | Caller-provided Time.deltaTime. |
| System.Single | speed | The speed to apply to the interpolation. |
Returns
| Type | Description |
|---|---|
| UnityEngine.Vector3 | New interpolated position closer to target |
Reset()
Stops the transform in place and terminates any animations.
Declaration
public void Reset()
Remarks
Reset() is usually reserved as a UnityEngine.MonoBehaviour API call in editor, but is used in this case as a convenience method.
SetTargetLocalPosition(Vector3)
Sets the target local position for the transform and if position wasn't already animating, fires the InterpolationStarted event.
Declaration
public void SetTargetLocalPosition(Vector3 target)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | target | The new target position to for the transform. |
SetTargetLocalRotation(Quaternion)
Sets the target local rotation for the transform and if rotation wasn't already animating, fires the InterpolationStarted event.
Declaration
public void SetTargetLocalRotation(Quaternion target)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Quaternion | target | The new target local rotation for the transform. |
SetTargetLocalScale(Vector3)
Sets the target local scale for the transform and if scale wasn't already animating, fires the InterpolationStarted event.
Declaration
public void SetTargetLocalScale(Vector3 target)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | target | The new target local rotation for the transform. |
SetTargetPosition(Vector3)
Sets the target position for the transform and if position wasn't already animating, fires the InterpolationStarted event.
Declaration
public void SetTargetPosition(Vector3 target)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | target | The new target position to for the transform. |
SetTargetRotation(Quaternion)
Sets the target rotation for the transform and if rotation wasn't already animating, fires the InterpolationStarted event.
Declaration
public void SetTargetRotation(Quaternion target)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Quaternion | target | The new target rotation for the transform. |
SnapToTarget()
Snaps to the final target and stops interpolating
Declaration
public void SnapToTarget()
StopInterpolating()
Stops the interpolation regardless if it has reached the target
Declaration
public void StopInterpolating()
Events
InterpolationDone
The event fired when an Interpolation is completed.
Declaration
public event Action InterpolationDone
Event Type
| Type | Description |
|---|---|
| System.Action |
InterpolationStarted
The event fired when an Interpolation is started.
Declaration
public event Action InterpolationStarted
Event Type
| Type | Description |
|---|---|
| System.Action |