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

DistanceGrabInteractor Class

The DistanceGrabInteractor enables the grabbing of a DistanceGrabInteractable from a distance using controllers.
It moves the interactable object using a configurable IMovement instance. Additionally, it employs a DistantCandidateComputer<TInteractor, TInteractable> to determine and hover over the most suitable candidate for interaction.

Fields

DistanceInteractable : IRelativeToRef
A reference to the main Transform of the currently selected DistanceGrabInteractable.
This property links back to the interactable object that is currently being manipulated by the user, allowing for continued interaction.
Signature
IRelativeToRef Oculus.Interaction.DistanceGrabInteractor.DistanceInteractable
Origin : Pose
The origin of the frustrums used by <cref="DistantCandidateComputer" />.
This property provides the starting point for the detection frustum, which is used to identify potential interactables.
Signature
Pose Oculus.Interaction.DistanceGrabInteractor.Origin

Properties

HitPoint : Vector3
[Get]
The hitpoint of your controller's frustrum.
This value represents the exact point where the frustum intersects with an interactable, providing a precise location for interaction.
Signature
Vector3 Oculus.Interaction.DistanceGrabInteractor.HitPoint
VelocityCalculator : IThrowVelocityCalculator
[Get][Set]
Signature
IThrowVelocityCalculator Oculus.Interaction.DistanceGrabInteractor.VelocityCalculator

Protected Methods

Awake ()
Signature
override void Oculus.Interaction.DistanceGrabInteractor.Awake()
Returns
override void
ComputeCandidate ()
Determines the best DistanceGrabInteractable candidate for selection based on the user's input and the current position of the interactor.
This method leverages the DistantCandidateComputer<TInteractor, TInteractable> to analyze the available interactables and select the one that best aligns with the user's input and the interactor's position. It updates the HitPoint property with the exact point of interaction for the selected candidate.
Signature
override DistanceGrabInteractable Oculus.Interaction.DistanceGrabInteractor.ComputeCandidate()
Returns
override DistanceGrabInteractable  The best DistanceGrabInteractable candidate, or null if no suitable candidate is found.
ComputePointerPose ()
Signature
override Pose Oculus.Interaction.DistanceGrabInteractor.ComputePointerPose()
Returns
override Pose
DoPreprocess ()
Signature
override void Oculus.Interaction.DistanceGrabInteractor.DoPreprocess()
Returns
override void
DoSelectUpdate ()
Updates the interactable's state while it is selected, ensuring it follows the target position.
This method is called during each frame while an interactable is selected, updating its position and rotation to match the target's current pose. It utilizes the movement provider to smoothly transition the interactable towards the target position.
Signature
override void Oculus.Interaction.DistanceGrabInteractor.DoSelectUpdate()
Returns
override void
InteractableSelected ( interactable )
Handles the logic required when a DistanceGrabInteractable is selected by the interactor.
This method initiates the movement sequence for the selected interactable using the configured movement provider. It also subscribes to pointer events from the interactable to manage its state during interaction.
Signature
override void Oculus.Interaction.DistanceGrabInteractor.InteractableSelected(DistanceGrabInteractable interactable)
Parameters
interactable: DistanceGrabInteractable  The DistanceGrabInteractable that has been selected.
Returns
override void
InteractableUnselected ( interactable )
Handles the logic required when a DistanceGrabInteractable is unselected by the interactor.
This method finalizes the interaction by unsubscribing from the interactable's pointer events and resetting the movement state. If a velocity calculator is available, it applies the calculated velocities to the interactable, simulating a throw or release action.
Signature
override void Oculus.Interaction.DistanceGrabInteractor.InteractableUnselected(DistanceGrabInteractable interactable)
Parameters
interactable: DistanceGrabInteractable  The DistanceGrabInteractable that has been unselected.
Returns
override void
Start ()
Signature
override void Oculus.Interaction.DistanceGrabInteractor.Start()
Returns
override void

Methods

InjectAllDistanceGrabInteractor ( selector , distantCandidateComputer )
Adds a DistanceGrabInteractor to a dynamically instantiated GameObject.
This method sets up the necessary components for a DistanceGrabInteractor, including the selector and candidate computer.
Signature
void Oculus.Interaction.DistanceGrabInteractor.InjectAllDistanceGrabInteractor(ISelector selector, DistantCandidateComputer< DistanceGrabInteractor, DistanceGrabInteractable > distantCandidateComputer)
Parameters
selector: ISelector
distantCandidateComputer: DistantCandidateComputer< DistanceGrabInteractor, DistanceGrabInteractable >
Returns
void
InjectDistantCandidateComputer ( distantCandidateComputer )
Adds a DistantCandidateComputer<TInteractor, TInteractable> to a dynamically instantiated GameObject.
This method injects the candidate computer, which is used to determine the best interactable to hover based on the user's input.
Signature
void Oculus.Interaction.DistanceGrabInteractor.InjectDistantCandidateComputer(DistantCandidateComputer< DistanceGrabInteractor, DistanceGrabInteractable > distantCandidateComputer)
Parameters
distantCandidateComputer: DistantCandidateComputer< DistanceGrabInteractor, DistanceGrabInteractable >
Returns
void
InjectOptionalGrabCenter ( grabCenter )
Adds a grab center to a dynamically instantiated GameObject.
Signature
void Oculus.Interaction.DistanceGrabInteractor.InjectOptionalGrabCenter(Transform grabCenter)
Parameters
grabCenter: Transform
Returns
void
InjectOptionalGrabTarget ( grabTarget )
Adds a grab target to a dynamically instantiated GameObject.
Signature
void Oculus.Interaction.DistanceGrabInteractor.InjectOptionalGrabTarget(Transform grabTarget)
Parameters
grabTarget: Transform
Returns
void
InjectOptionalVelocityCalculator ( velocityCalculator )
Adds a IThrowVelocityCalculator to a dynamically instantiated GameObject.
This method is marked as obsolete and should no longer be used. Use Grabbable instead.
Signature
void Oculus.Interaction.DistanceGrabInteractor.InjectOptionalVelocityCalculator(IThrowVelocityCalculator velocityCalculator)
Parameters
velocityCalculator: IThrowVelocityCalculator
Returns
void
InjectSelector ( selector )
Adds an ISelector to a dynamically instantiated GameObject.
This method injects the selector, which is responsible for detecting the user's input to initiate the grab action.
Signature
void Oculus.Interaction.DistanceGrabInteractor.InjectSelector(ISelector selector)
Parameters
selector: ISelector
Returns
void