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

HandGrabInteractor Class

Enables hand grab for objects within arm's reach that have a <cref="GrabInteractable" />.
When grabbing an object, the hands visually snap to any <cref="HandPose" /> you've provided. To enable grab for controllers, use GrabInteractor.

Properties

IHand Hand[Get]
bool HoverOnZeroStrength[Get]
IThrowVelocityCalculator VelocityCalculator[Get]
IMovement Movement[Get]
bool MovementFinished[Get]
HandGrabTarget HandGrabTarget[Get]
float FingersStrength[Get]
float WristStrength[Get]
Pose WristToGrabPoseOffset[Get]

Fields

Transform WristPoint[Get]
Transform PinchPoint[Get]
Transform PalmPoint[Get]
HandGrabAPI HandGrabApi[Get]
GrabTypeFlags SupportedGrabTypes[Get]
IHandGrabInteractable TargetInteractable[Get]
bool IsGrabbing[Get]
Rigidbody Rigidbody[Get]

Member Functions

Returns the fingers that are grabbing the interactable.
override bool CanSelect
( HandGrabInteractable interactable )
Forces the interactor to select the passed interactable, which will be grabbed in the next interaction iteration.
Parameters
interactable
The interactable to grab.
allowManualRelease
If false, the interactable can only be released by calling ForceRelease.
Forces the interactor to deselect the currently grabbed interactable (if any).
override void SetComputeCandidateOverride
( Func< HandGrabInteractable > computeCandidate,
bool shouldClearOverrideOnSelect )
override void Unselect ( )
Adds everything contained in <cref="HandGrabInteractor"/> to a dynamically instantiated GameObject.
Adds a <cref="HandGrabAPI" /> to a dynamically instantiated GameObject.
Adds a <cref="IHand" /> to a dynamically instantiated GameObject.
Adds a Rigidbody to a dynamically instantiated GameObject.
Adds a list of <cref="GrabTypeFlags" /> to a dynamically instantiated GameObject.
Adds a grab origin to a dynamically instantiated GameObject.
Adds a grip point to a dynamically instantiated GameObject.
Adds a grip collider to a dynamically instantiated GameObject.
Adds a pinch point to a dynamically instantiated GameObject.
Adds a pinch collider to a dynamically instantiated GameObject.
Adds a velocity calculator to a dynamically instantiated GameObject.

Protected Functions

virtual void Reset ( )
override void Awake ( )
override void Start ( )
Each call while the interactor is hovering, it checks whether there is an interaction being hovered and sets the target snap pose to it.
In the HandToObject snapping behaviors this is relevant as the hand can approach the object progressively even before a true grab starts.
override void InteractableSet
( HandGrabInteractable interactable )
override void InteractableUnset
( HandGrabInteractable interactable )
Each call while the hand is selecting/grabbing an interactable, it moves the item to the new position while also attracting it towards the hand if the snapping mode requires it.
In some cases the parameter can be null, for example if the selection was interrupted by another hand grabbing the object. In those cases it will come out of the release state once the grabbing gesture properly finishes.
When a new interactable is selected, start the grab at the ideal point.
When snapping is involved that can be a point in the interactable offset from the hand which will be stored to progressively reduced it in the next updates, effectively attracting the object towards the hand. When no snapping is involved the point will be the grip point of the hand directly. Note: ideally this code would be in InteractableSelected but it needs to be called before the object is marked as active.
Parameters
interactable
The selected interactable
When releasing an active interactable, calculate the releasing point in similar fashion to InteractableSelected.
Parameters
interactable
The released interactable
virtual override void HandlePointerEventRaised
( PointerEvent evt )
virtual override Pose ComputePointerPose ( )
override bool ComputeShouldSelect ( )
override bool ComputeShouldUnselect ( )
Compute the best interactable to snap to.
In order to do it the method measures the score from the current grip pose to the closes pose in the surfaces of each one of the interactables in the registry. Even though it returns the best interactable, it also saves the entire Snap pose to it in which the exact pose within the surface is already recorded to avoid recalculations within the same frame.
Returns
The best interactable to snap the hand to.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon