Class TrackedDevicePhysicsRaycaster
Physics-based UI Raycaster for Tracked Devices (e.g. XR Controllers). Detects UI elements with physics colliders attached to their GameObjects.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.UI
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("Event/Tracked Device Physics Raycaster", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@2.5/api/UnityEngine.XR.Interaction.Toolkit.UI.TrackedDevicePhysicsRaycaster.html")]
public class TrackedDevicePhysicsRaycaster : BaseRaycaster
Remarks
Does not need to be attached to any canvas. UI elements are any element inheriting from UnityEngine.EventSystems.IEventSystemHandler. 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 |
Overrides
See Also
eventMask
Layer mask used to filter events. Always combined with the ray cast mask of the IUIInteractor.
Declaration
public LayerMask eventMask { get; set; }
Property Value
Type | Description |
---|---|
LayerMask |
See Also
maxRayIntersections
Max number of ray intersections allowed to be found.
Declaration
public int maxRayIntersections { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
Value will be clamped to greater than 0.
See Also
raycastTriggerInteraction
Specifies whether the ray cast should hit triggers.
Declaration
public QueryTriggerInteraction raycastTriggerInteraction { get; set; }
Property Value
Type | Description |
---|---|
QueryTriggerInteraction |
See Also
Methods
Awake()
See MonoBehaviour.Awake.
Declaration
protected override void Awake()
Overrides
See Also
Raycast(PointerEventData, List<RaycastResult>)
Performs a ray cast 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 ray cast. |
List<RaycastResult> | resultAppendList | The resultant hits from the ray cast. |
Overrides
Remarks
Will only process events of type TrackedDeviceEventData.
See Also
SetEventCamera(Camera)
Sets the event camera for this ray caster. The event camera is used to determine the screen position and display of the ray cast results.
Declaration
public void SetEventCamera(Camera newEventCamera)
Parameters
Type | Name | Description |
---|---|---|
Camera | newEventCamera | The new Camera to set as this ray caster's eventCamera. |