docs.unity3d.com
    Show / Hide Table of Contents

    Class XRAngleGazeEvaluator

    Evaluates the angle between the Gaze Transform's forward direction and the vector to the target Interactable. The target Interactable with the smallest angle will receive the highest normalized score.

    Inheritance
    Object
    XRTargetEvaluator
    XRAngleGazeEvaluator
    Inherited Members
    XRTargetEvaluator.filter
    XRTargetEvaluator.enabled
    XRTargetEvaluator.weight
    XRTargetEvaluator.disposed
    XRTargetEvaluator.Awake()
    XRTargetEvaluator.OnDispose()
    XRTargetEvaluator.OnDisable()
    XRTargetEvaluator.GetWeightedScore(IXRInteractor, IXRInteractable)
    XRTargetEvaluator.Dispose()
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.Interaction.Toolkit.Filtering
    Syntax
    [Serializable]
    public class XRAngleGazeEvaluator : XRTargetEvaluator, IDisposable

    Properties

    gazeTransform

    The Transform whose forward direction is used to evaluate the target Interactable angle. If none is specified, during OnEnable this property is initialized with the XROrigin Camera.

    Declaration
    public Transform gazeTransform { get; set; }
    Property Value
    Type Description
    Transform

    maxAngle

    The maximum value an angle can be evaluated as before the Interactor receives a normalized score of 0. Think of it as a field-of-view angle.

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

    Methods

    CalculateNormalizedScore(IXRInteractor, IXRInteractable)

    Calculates and returns a normalized value that represents the intention to select the given target Interactable.
    The highest score of 1 represents the intention to select the given target and the lowest score of 0 the intention to not select it, any value in between is valid.

    Declaration
    protected override float CalculateNormalizedScore(IXRInteractor interactor, IXRInteractable target)
    Parameters
    Type Name Description
    IXRInteractor interactor

    The Interactor whose Interactable targets (candidates) are being evaluated.

    IXRInteractable target

    The target Interactable to evaluate the normalized score.

    Returns
    Type Description
    Single

    Returns the normalized interaction score of the given target.
    It's a good practice to return a value between 0 and 1 inclusive and edit the weight curve to evaluate the target weighted interaction score.

    Overrides
    XRTargetEvaluator.CalculateNormalizedScore(IXRInteractor, IXRInteractable)
    Remarks

    The returned normalized score is evaluated by the weight curve (in GetWeightedScore(IXRInteractor, IXRInteractable)) and then (in Process(IXRInteractor, List<IXRInteractable>, List<IXRInteractable>)) it's multiplied by the other evaluator weighted score in the same filter to get the target final score.
    You cannot disable, remove, or dispose evaluators from the filter in this method. You also cannot unlink Interactors from the filter in this method.

    See Also
    XRTargetFilter
    GetValidTargets(List<IXRInteractable>)

    OnEnable()

    Unity calls this automatically when the evaluator becomes enabled and active.

    Declaration
    protected override void OnEnable()
    Overrides
    XRTargetEvaluator.OnEnable()
    See Also
    enabled

    Reset()

    (Editor Only) Unity calls this automatically when adding the evaluator to the Filter Target the first time. This function is only called in the Unity editor. Reset is most commonly used to give good default values in the Inspector.

    Declaration
    public override void Reset()
    Overrides
    XRTargetEvaluator.Reset()
    Back to top
    Terms of use
    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