docs.unity3d.com
    Show / Hide Table of Contents

    Class TrackedDevicePhysicsRaycaster

    Physics-based UI Raycaster for Tracked Devices (e.g. XR Controllers). Detects UI elements with physics colliders attached to their GameObjects.

    Inheritance
    Object
    TrackedDevicePhysicsRaycaster
    Namespace: UnityEngine.XR.Interaction.Toolkit.UI
    Syntax
    public class TrackedDevicePhysicsRaycaster : BaseRaycaster
    Remarks

    Does not need to be attached to any canvas. UI elements are any element inheriting from . Designed to work with XRUIInputModule, which configures the final screen position once all hits are tallied.

    Properties

    eventCamera

    Declaration
    public override Camera eventCamera { get; }
    Property Value
    Type Description
    Camera

    eventMask

    Layer mask used to filter events. Always combined with the raycast mask of the IUIInteractor.

    Declaration
    public LayerMask eventMask { get; set; }
    Property Value
    Type Description
    LayerMask

    maxRayIntersections

    Max number of ray intersections allowed to be found.

    Declaration
    public int maxRayIntersections { get; set; }
    Property Value
    Type Description
    Int32
    Remarks

    Value will be clamped to greater than 0.

    raycastTriggerInteraction

    Specifies whether the raycast should hit triggers.

    Declaration
    public QueryTriggerInteraction raycastTriggerInteraction { get; set; }
    Property Value
    Type Description
    QueryTriggerInteraction

    Methods

    Awake()

    Declaration
    protected override void Awake()

    Raycast(PointerEventData, List<RaycastResult>)

    Perform a raycast against all physics objects using this event.

    Declaration
    public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
    Parameters
    Type Name Description
    PointerEventData eventData

    Data containing where and how to raycast.

    List<RaycastResult> resultAppendList

    The resultant hits from the raycast.

    Remarks

    Will only process events of type TrackedDeviceEventData.

    SetEventCamera(Camera)

    Sets the event camera for this raycaster. The event camera is used to determine the screen position and display of the raycast results.

    Declaration
    public void SetEventCamera(Camera newEventCamera)
    Parameters
    Type Name Description
    Camera newEventCamera

    The new to set as this raycaster's eventCamera.

    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