docs.unity3d.com
Search Results for

    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(float, float, float)) 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
    Implements
    IReadOnlyBindableVariable<float3>
    IDisposable
    Inherited Members
    Vector3TweenableVariable.ScheduleTweenJob(ref TweenJobData<float3>)
    TweenableVariableAsyncBase<float3>.Value
    TweenableVariableAsyncBase<float3>.Dispose()
    TweenableVariableAsyncBase<float3>.PreprocessTween()
    TweenableVariableAsyncBase<float3>.ExecuteTween(float3, float3, float, bool)
    TweenableVariableAsyncBase<float3>.OnAnimationCurveChanged(AnimationCurve)
    TweenableVariableBase<float3>.k_NearlyOne
    TweenableVariableBase<float3>.animationCurve
    TweenableVariableBase<float3>.target
    TweenableVariableBase<float3>.initialValue
    TweenableVariableBase<float3>.HandleTween(float)
    TweenableVariableBase<float3>.StartAutoTween(float)
    TweenableVariableBase<float3>.PlaySequence(float3, float3, float, Action)
    BindableVariable<float3>.ValueEquals(float3)
    BindableVariableBase<float3>.BindingCount
    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, bool>, CancellationToken)
    BindableVariableBase<float3>.Task(float3, CancellationToken)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.Interaction.Toolkit.Utilities.Tweenables.SmartTweenableVariables
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    public class SmartFollowVector3TweenableVariable : Vector3TweenableVariable, IReadOnlyBindableVariable<float3>, IDisposable

    Constructors

    SmartFollowVector3TweenableVariable(float, float, float)

    Initializes and returns an instance of SmartFollowVector3TweenableVariable.

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

    Minimum distance from target before which tween starts.

    float maxDistanceAllowed

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

    float minToMaxDelaySeconds

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

    See Also
    SmartFollowQuaternionTweenableVariable

    Properties

    maxDistanceAllowed

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

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

    minDistanceAllowed

    Minimum distance from target before which tween starts.

    Declaration
    public float minDistanceAllowed { get; set; }
    Property Value
    Type Description
    float
    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
    float
    See Also
    SmartFollowQuaternionTweenableVariable

    Methods

    HandleSmartTween(float, float, float)

    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
    float deltaTime

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

    float lowerSpeed

    Lower range speed for tweening.

    float upperSpeed

    Upper range speed for tweening.

    See Also
    HandleTween(float)

    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
    bool

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

    See Also
    SmartFollowQuaternionTweenableVariable

    OnTargetChanged(float3)

    Callback when new tween target value is assigned.

    Declaration
    protected override void OnTargetChanged(float3 newTarget)
    Parameters
    Type Name Description
    float3 newTarget

    New target value.

    Overrides
    TweenableVariableBase<float3>.OnTargetChanged(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
    bool

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

    See Also
    SmartFollowQuaternionTweenableVariable

    Implements

    Unity.XR.CoreUtils.Bindings.Variables.IReadOnlyBindableVariable<T>
    IDisposable

    See Also

    SmartFollowQuaternionTweenableVariable
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)