docs.unity3d.com
    Show / Hide Table of Contents

    Class SmartFollowQuaternionTweenableVariable

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

    • A dynamic threshold angle 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<Quaternion>
    BindableVariable<Quaternion>
    TweenableVariableBase<Quaternion>
    TweenableVariableSynchronousBase<Quaternion>
    QuaternionTweenableVariable
    SmartFollowQuaternionTweenableVariable
    Inherited Members
    QuaternionTweenableVariable.angleEqualityThreshold
    QuaternionTweenableVariable.Lerp(Quaternion, Quaternion, Single)
    QuaternionTweenableVariable.IsNearlyEqual(Quaternion, Quaternion)
    TweenableVariableSynchronousBase<Quaternion>.ExecuteTween(Quaternion, Quaternion, Single, Boolean)
    TweenableVariableBase<Quaternion>.k_NearlyOne
    TweenableVariableBase<Quaternion>.animationCurve
    TweenableVariableBase<Quaternion>.target
    TweenableVariableBase<Quaternion>.initialValue
    TweenableVariableBase<Quaternion>.HandleTween(Single)
    TweenableVariableBase<Quaternion>.StartAutoTween(Single)
    TweenableVariableBase<Quaternion>.PlaySequence(Quaternion, Quaternion, Single, Action)
    TweenableVariableBase<Quaternion>.OnAnimationCurveChanged(AnimationCurve)
    TweenableVariableBase<Quaternion>.PreprocessTween()
    BindableVariable<Quaternion>.ValueEquals(Quaternion)
    BindableVariableBase<Quaternion>.SetValueWithoutNotify(Quaternion)
    BindableVariableBase<Quaternion>.Subscribe(Action<Quaternion>)
    BindableVariableBase<Quaternion>.SubscribeAndUpdate(Action<Quaternion>)
    BindableVariableBase<Quaternion>.Unsubscribe(Action<Quaternion>)
    BindableVariableBase<Quaternion>.BroadcastValue()
    BindableVariableBase<Quaternion>.Task(Func<Quaternion, Boolean>, CancellationToken)
    BindableVariableBase<Quaternion>.Task(Quaternion, CancellationToken)
    BindableVariableBase<Quaternion>.Value
    BindableVariableBase<Quaternion>.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 SmartFollowQuaternionTweenableVariable : QuaternionTweenableVariable, IReadOnlyBindableVariable<Quaternion>

    Constructors

    SmartFollowQuaternionTweenableVariable(Single, Single, Single)

    Constructor for SmartFollowQuaternionTweenableVariable.

    Declaration
    public SmartFollowQuaternionTweenableVariable(float minAngleAllowed = 0.1F, float maxAngleAllowed = 5F, float minToMaxDelaySeconds = 3F)
    Parameters
    Type Name Description
    Single minAngleAllowed

    Minimum angle offset (in degrees) from target before which tween starts.

    Single maxAngleAllowed

    Maximum angle offset (in degrees) from target before tween targets, when time threshold is reached.

    Single minToMaxDelaySeconds

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

    Properties

    maxAngleAllowed

    Maximum angle offset allowed in degrees.

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

    minAngleAllowed

    Minimum angle offset allowed in degrees.

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

    minToMaxDelaySeconds

    Time required to elapse before the max angle offset allowed goes from the min angle 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
    Single lowerSpeed
    Single upperSpeed

    IsNewTargetWithinThreshold(Quaternion)

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

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

    The new target rotation as a Quaternion.

    Returns
    Type Description
    Boolean

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

    OnTargetChanged(Quaternion)

    Callback when new tween target value is assigned.

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

    SetTargetWithinThreshold(Quaternion)

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

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

    The new target rotation as a Quaternion.

    Returns
    Type Description
    Boolean

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

    See Also

    SmartFollowVector3TweenableVariable
    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