Class Interpolator
A MonoBehaviour that interpolates a transform's position, rotation or scale.
Namespace: Microsoft.MixedReality.Toolkit.Physics
Assembly: cs.temp.dll.dll
Syntax
public class Interpolator : MonoBehaviour
Properties
AnimatingLocalRotation
True if the transform's local rotation is animating; false otherwise.
Declaration
public bool AnimatingLocalRotation { get; }
Property Value
Type | Description |
---|---|
Boolean |
AnimatingLocalScale
True if the transform's scale is animating; false otherwise.
Declaration
public bool AnimatingLocalScale { get; }
Property Value
Type | Description |
---|---|
Boolean |
AnimatingPosition
True if the transform's position is animating; false otherwise.
Declaration
public bool AnimatingPosition { get; }
Property Value
Type | Description |
---|---|
Boolean |
AnimatingRotation
True if the transform's rotation is animating; false otherwise.
Declaration
public bool AnimatingRotation { get; }
Property Value
Type | Description |
---|---|
Boolean |
PositionVelocity
The velocity of a transform whose position is being interpolated.
Declaration
public Vector3 PositionVelocity { get; }
Property Value
Type | Description |
---|---|
Vector3 |
Running
True if position, rotation or scale are animating; false otherwise.
Declaration
public bool Running { get; }
Property Value
Type | Description |
---|---|
Boolean |
SmoothLerpToTarget
Lerp the estimated targets towards the object each update, slowing and smoothing movement.
Declaration
public bool SmoothLerpToTarget { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
SmoothPositionLerpRatio
Declaration
public float SmoothPositionLerpRatio { get; set; }
Property Value
Type | Description |
---|---|
Single |
SmoothRotationLerpRatio
Declaration
public float SmoothRotationLerpRatio { get; set; }
Property Value
Type | Description |
---|---|
Single |
SmoothScaleLerpRatio
Declaration
public float SmoothScaleLerpRatio { get; set; }
Property Value
Type | Description |
---|---|
Single |
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 |
---|---|
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 |
---|---|
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 |
---|---|
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 |
---|---|
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 |
---|---|---|
Vector3 | start | The starting position. |
Vector3 | target | The destination position. |
Single | deltaTime | Caller-provided Time.deltaTime. |
Single | speed | The speed to apply to the interpolation. |
Returns
Type | Description |
---|---|
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 MonoBehaviour API call in editor, but is used in this case as a convenience method.
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 |
---|---|---|
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 |
---|---|---|
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 |
---|---|---|
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 |
---|---|---|
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 |
---|---|
Action |
InterpolationStarted
The event fired when an Interpolation is started.
Declaration
public event Action InterpolationStarted
Event Type
Type | Description |
---|---|
Action |