docs.unity3d.com
    Show / Hide Table of Contents

    Class FollowPreset

    Class that defines the configuration of a following behaviour for a hand or object. It determines how an object should follow the hand and includes specifications about local position and rotation, angle constraints, gaze snapping, and smoothing settings.

    Inheritance
    Object
    FollowPreset
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.Interaction.Toolkit.UI.BodyUI
    Syntax
    [Serializable]
    public class FollowPreset

    Fields

    allowSmoothing

    Whether to allow smoothing of the following element position and rotation.

    Declaration
    [Header("Smoothing Config")]
    [Tooltip("Whether to allow smoothing of the following element position and rotation.")]
    public bool allowSmoothing
    Field Value
    Type Description
    Boolean

    followLowerSmoothingValue

    The lower bound of smoothing to apply.

    Declaration
    [Tooltip("The lower bound of smoothing to apply.")]
    public float followLowerSmoothingValue
    Field Value
    Type Description
    Single

    followUpperSmoothingValue

    The upper bound of smoothing to apply.

    Declaration
    [Tooltip("The upper bound of smoothing to apply.")]
    public float followUpperSmoothingValue
    Field Value
    Type Description
    Single

    hideDelaySeconds

    The amount of time in seconds to wait before hiding the following element after the hand is no longer tracked.

    Declaration
    [Header("Hide delay config")]
    [Tooltip("The amount of time in seconds to wait before hiding the following element after the hand is no longer tracked.")]
    public float hideDelaySeconds
    Field Value
    Type Description
    Single

    invertAxisForRightHand

    Given that the default reference hand for menus is the left hand, it may be required to mirror the reference axis for the right hand. This is not necessary if using the up or down axis as a reference, which is the default for hand tracking. Controllers work best with the right and left axies.

    Declaration
    [Tooltip("Given that the default reference hand for menus is the left hand, it may be required to mirror the reference axis for the right hand.")]
    public bool invertAxisForRightHand
    Field Value
    Type Description
    Boolean

    leftHandLocalPosition

    Local space anchor position for the left hand.

    Declaration
    [Tooltip("Local space anchor position for the left hand.")]
    public Vector3 leftHandLocalPosition
    Field Value
    Type Description
    Vector3

    leftHandLocalRotation

    Local space anchor rotation for the left hand.

    Declaration
    [Tooltip("Local space anchor rotation for the left hand.")]
    public Vector3 leftHandLocalRotation
    Field Value
    Type Description
    Vector3

    palmFacingUpDegreeAngleThreshold

    Angle threshold to check if the palm reference axis is facing up.

    Declaration
    [Tooltip("The angle threshold in degrees to check if the palm reference axis is facing up.")]
    public float palmFacingUpDegreeAngleThreshold
    Field Value
    Type Description
    Single

    palmFacingUserDegreeAngleThreshold

    Angle threshold to check if the palm reference axis is facing the user.

    Declaration
    [Tooltip("The angle threshold in degrees to check if the palm reference axis is facing the user.")]
    public float palmFacingUserDegreeAngleThreshold
    Field Value
    Type Description
    Single

    palmReferenceAxis

    Reference axis equivalent used for comparisons with the user's gaze direction and the world up direction.

    Declaration
    [Header("Hand anchor angle constraints")]
    [Tooltip("Reference axis equivalent used for comparisons with the user's gaze direction and the world up direction.")]
    public FollowReferenceAxis palmReferenceAxis
    Field Value
    Type Description
    FollowReferenceAxis

    requirePalmFacingUp

    Check status of palm reference axis facing up.

    Declaration
    [Tooltip("Whether or not check if the palm reference axis is facing up.")]
    public bool requirePalmFacingUp
    Field Value
    Type Description
    Boolean

    requirePalmFacingUser

    Check status of palm reference axis facing the user.

    Declaration
    [Tooltip("Whether or not check if the palm reference axis is facing the user.")]
    public bool requirePalmFacingUser
    Field Value
    Type Description
    Boolean

    rightHandLocalPosition

    Local space anchor position for the right hand.

    Declaration
    [Header("Local Space Anchor Transform")]
    [Tooltip("Local space anchor position for the right hand.")]
    public Vector3 rightHandLocalPosition
    Field Value
    Type Description
    Vector3

    rightHandLocalRotation

    Local space anchor rotation for the right hand.

    Declaration
    [Tooltip("Local space anchor rotation for the right hand.")]
    public Vector3 rightHandLocalRotation
    Field Value
    Type Description
    Vector3

    snapToGaze

    Configures the snap to gaze option.

    Declaration
    [Header("Snap To gaze config")]
    [Tooltip("Whether to snap the following element to the gaze direction.")]
    public bool snapToGaze
    Field Value
    Type Description
    Boolean

    snapToGazeAngleThreshold

    The angle threshold in degrees to snap the following element to the gaze direction.

    Declaration
    [Tooltip("The angle threshold in degrees to snap the following element to the gaze direction.")]
    public float snapToGazeAngleThreshold
    Field Value
    Type Description
    Single

    Properties

    palmFacingUpDotThreshold

    The dot product equivalent to the angle threshold used to check if the palm reference axis is facing up.

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

    palmFacingUserDotThreshold

    The dot product equivalent to the angle threshold used to check if the palm reference axis is facing the user.

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

    snapToGazeDotThreshold

    Dot product threshold for snap to gaze.

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

    Methods

    ApplyPreset(Transform, Transform)

    Applies this preset to the specified tracking offsets for the left and right local positions and rotations. Also recomputes dot product thresholds.

    Declaration
    public void ApplyPreset(Transform leftTrackingOffset, Transform rightTrackingOffset)
    Parameters
    Type Name Description
    Transform leftTrackingOffset

    The transform object that represents the left tracking offset.

    Transform rightTrackingOffset

    The transform object that represents the right tracking offset.

    ComputeDotProductThresholds()

    Update the dot product thresholds based on the current angle thresholds.

    Declaration
    public void ComputeDotProductThresholds()

    GetReferenceAxisForTrackingAnchor(Transform, Boolean)

    Gets the reference axis relative to the specified tracking root. Adjusts the return value depending on whether or not this is for the user's right hand.

    Declaration
    public Vector3 GetReferenceAxisForTrackingAnchor(Transform trackingRoot, bool isRightHand)
    Parameters
    Type Name Description
    Transform trackingRoot

    Tracking root transform.

    Boolean isRightHand

    Whether this is for the user's right hand or not.

    Returns
    Type Description
    Vector3
    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