docs.unity3d.com
    Show / Hide Table of Contents

    Class SmartFollowVector3TweenableVariable

    This class expands on the vector3 tweenable variable to introduce two concepts:

    • A dynamic threshold distance that grows over time in a range, that prevents updating the target so long as the value being assigned to the target is within that threshold.
    • A variable speed tween (HandleSmartTween(Single, Single, Single)) that inputs a lower and upper range speed for tweening. The closer the value is to the target, the faster the tween.

    Inheritance
    Object
    BindableVariableBase<float3>
    BindableVariable<float3>
    TweenableVariableBase<float3>
    TweenableVariableAsyncBase<float3>
    Vector3TweenableVariable
    SmartFollowVector3TweenableVariable
    Inherited Members
    Vector3TweenableVariable.ScheduleTweenJob(TweenJobData<float3>)
    TweenableVariableAsyncBase<float3>.Value
    TweenableVariableAsyncBase<float3>.Dispose()
    TweenableVariableAsyncBase<float3>.PreprocessTween()
    TweenableVariableAsyncBase<float3>.ExecuteTween(float3, float3, Single, Boolean)
    TweenableVariableAsyncBase<float3>.OnAnimationCurveChanged(AnimationCurve)
    TweenableVariableBase<float3>.k_NearlyOne
    TweenableVariableBase<float3>.animationCurve
    TweenableVariableBase<float3>.target
    TweenableVariableBase<float3>.initialValue
    TweenableVariableBase<float3>.HandleTween(Single)
    TweenableVariableBase<float3>.StartAutoTween(Single)
    TweenableVariableBase<float3>.PlaySequence(float3, float3, Single, Action)
    BindableVariable<float3>.ValueEquals(float3)
    BindableVariableBase<float3>.SetValueWithoutNotify(float3)
    BindableVariableBase<float3>.Subscribe(Action<float3>)
    BindableVariableBase<float3>.SubscribeAndUpdate(Action<float3>)
    BindableVariableBase<float3>.Unsubscribe(Action<float3>)
    BindableVariableBase<float3>.BroadcastValue()
    BindableVariableBase<float3>.Task(Func<float3, Boolean>, CancellationToken)
    BindableVariableBase<float3>.Task(float3, CancellationToken)
    BindableVariableBase<float3>.BindingCount
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.Interaction.Toolkit.Utilities.Tweenables.SmartTweenableVariables
    Syntax
    public class SmartFollowVector3TweenableVariable : Vector3TweenableVariable, IReadOnlyBindableVariable<float3>, IDisposable

    Constructors

    SmartFollowVector3TweenableVariable(Single, Single, Single)

    Initializes and returns an instance of SmartFollowVector3TweenableVariable.

    Declaration
    public SmartFollowVector3TweenableVariable(float minDistanceAllowed = 0.01F, float maxDistanceAllowed = 0.3F, float minToMaxDelaySeconds = 3F)
    Parameters
    Type Name Description
    Single minDistanceAllowed

    Minimum distance from target before which tween starts.

    Single maxDistanceAllowed

    Maximum distance from target before tween targets, when time threshold is reached.

    Single minToMaxDelaySeconds

    Time required to elapse (in seconds) before the max distance allowed goes from the min distance to the max.

    Properties

    maxDistanceAllowed

    Maximum distance from target before tween targets, when time threshold is reached.

    Declaration
    public float maxDistanceAllowed { get; set; }
    Property Value
    Type Description
    Single
    See Also
    minDistanceAllowed

    minDistanceAllowed

    Minimum distance from target before which tween starts.

    Declaration
    public float minDistanceAllowed { get; set; }
    Property Value
    Type Description
    Single
    See Also
    maxDistanceAllowed

    minToMaxDelaySeconds

    Time required to elapse before the max distance allowed goes from the min distance to the max.

    Declaration
    public float minToMaxDelaySeconds { get; set; }
    Property Value
    Type Description
    Single

    Methods

    HandleSmartTween(Single, Single, Single)

    Tween to new target with variable speed according to distance from target. The closer the target is to the current value, the faster the tween.

    Declaration
    public void HandleSmartTween(float deltaTime, float lowerSpeed, float upperSpeed)
    Parameters
    Type Name Description
    Single deltaTime

    Time in seconds since the last frame (such as deltaTime).

    Single lowerSpeed

    Lower range speed for tweening.

    Single upperSpeed

    Upper range speed for tweening.

    See Also
    HandleTween(Single)

    IsNewTargetWithinThreshold(float3)

    Checks if the squared distance between the current target and a new target is within a dynamically determined threshold, based on the time since the last update.

    Declaration
    public bool IsNewTargetWithinThreshold(float3 newTarget)
    Parameters
    Type Name Description
    float3 newTarget

    The new target position as a float3 vector.

    Returns
    Type Description
    Boolean

    Returns true if the squared distance between the current and new targets is within the allowed threshold, false otherwise.

    OnTargetChanged(float3)

    Callback when new tween target value is assigned.

    Declaration
    protected override void OnTargetChanged(float3 newTarget)
    Parameters
    Type Name Description
    float3 newTarget
    Overrides
    UnityEngine.XR.Interaction.Toolkit.Utilities.Tweenables.TweenableVariableBase<Unity.Mathematics.float3>.OnTargetChanged(Unity.Mathematics.float3)
    See Also
    target

    SetTargetWithinThreshold(float3)

    Updates the target position to a new value if it is within a dynamically determined threshold, based on the time since the last update.

    Declaration
    public bool SetTargetWithinThreshold(float3 newTarget)
    Parameters
    Type Name Description
    float3 newTarget

    The new target position as a float3 vector.

    Returns
    Type Description
    Boolean

    Returns Returns true if the target position is updated, Returns false otherwise.

    See Also

    SmartFollowQuaternionTweenableVariable
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023