Class XRInteractableUtility
Utility methods for Interactables.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Utilities
Syntax
public static class XRInteractableUtility
Methods
TryGetClosestCollider(IXRInteractable, Vector3, out DistanceInfo)
Calculates the closest Interactable's Collider to the given location (based on the Collider Transform position). The Collider volume and surface are not considered for calculation, use TryGetClosestPointOnCollider(IXRInteractable, Vector3, out DistanceInfo) in this case.
Declaration
public static bool TryGetClosestCollider(IXRInteractable interactable, Vector3 position, out DistanceInfo distanceInfo)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | Interactable to find the closest Collider position. |
Vector3 | position | Location in world space to calculate the closest Collider position. |
DistanceInfo | distanceInfo | If true is returned, |
Returns
Type | Description |
---|---|
Boolean | Returns true if the closest Collider can be computed, for this the |
Remarks
Only active and enabled non-trigger colliders are used in the calculation.
See Also
TryGetClosestPointOnCollider(IXRInteractable, Vector3, out DistanceInfo)
Calculates the point on the Interactable's Colliders that is closest to the given location (based on the Collider volume and surface).
Declaration
public static bool TryGetClosestPointOnCollider(IXRInteractable interactable, Vector3 position, out DistanceInfo distanceInfo)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | Interactable to find the closest point. |
Vector3 | position | Location in world space to calculate the closest point. |
DistanceInfo | distanceInfo | If true is returned, |
Returns
Type | Description |
---|---|
Boolean | Returns true if the closest point can be computed, for this the |
Remarks
Only active and enabled non-trigger colliders are used in the calculation. The colliders can only be a BoxCollider, SphereCollider, CapsuleCollider, or convex MeshCollider.