API reference
API reference
Select your platform
No SDKs available
No versions available

RayInteractable Class

Defines a raycast interaction suitable to use at both short and long ranges.
The possibility of interaction is triggered by the intersection between the RayInteractor's raycast and the interactable's Surface. Consequences of interaction can be controlled by setting the interactable's movement provider (through the UnityEditor or via InjectOptionalMovementProvider(IMovementProvider)), by observing the interactable's IInteractable events (for example, using an InteractableUnityEventWrapper), or by handling the PointerEvents emitted during interaction (for example, by forwarding them to an IPointableCanvas).

Properties

The mesh used as the interactive surface for the ray.
This value of this property is typically set in the UnityEditor, but it can also be set programmatically using InjectSurface(ISurface).
IMovementProvider MovementProvider[Get]
If a RayInteractor's raycast strikes multiple interactables such that it is equally interactable with any of them, the interactable with the largest TiebreakerScore wins and is targeted for interaction.
If there's a tie for largest TiebreakerScore, one of the interactables will be selected arbitrarily.

Protected Functions

override void Awake ( )
override void Start ( )

Member Functions

Called when the interactor has a set of interactables and is calculating which one is closest.
Parameters
ray
The position and direction of the ray.
hit
The location, normal, and distance of the ray hit.
maxDistance
The maximum ray length.
selectSurface
True if the raycast has hit the selectable part of the <cref="RayInteractable" />, otherwise false.
Returns
Returns true if hit.
Generates movement to move the <cref="RayInteractable" /> from its current position to the target position.
Parameters
to
The target position.
source
The current position.
Returns
Returns the movement that will be applied to the interactable.
Injects all required dependencies for a dynamically instantiated RayInteractable; because only Surface is required, this simply wraps InjectSurface(ISurface).
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Sets an ISurface as the Surface for a dynamically instantiated RayInteractable.
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Sets an ISurface as the select surface for a dynamically instantiated RayInteractable.
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Sets an IMovementProvider for a dynamically instantiated RayInteractable.
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon