Distance Hand Grab Interactions
Design Guideline: Providing a comfortable hand tracking experience is essential for creating immersive and enjoyable apps. Refer to the
Hand Tracking Design Guide to learn about best practices and to minimize risks of user discomfort.
Distance Hand Grab lets you use your hands to grab and move objects that are out of arm’s reach. Typically, this means attracting the object toward the hand and then grabbing like you do in a hand grab interaction.
Note: If you are just getting started with this Meta XR feature, we recommend that you use
Building Blocks, a Unity extension for Meta XR SDKs, to quickly add features to your project.
DistanceHandGrabInteractor
The DistanceHandGrabInteractor is the
Interactor
class for this interaction. Like
HandGrabInteractor, it uses the
HandGrabAPI, Wrist, Grip, and PinchPoints, and can align a Synthetic hand visually. However, it detects eligible interactables differently.
To detect and select the best distant interactables, DistanceHandGrabInteractor uses multiple conical frustums.
- SelectionFrustum: Objects inside this frustum are checked immediately, and the most centered one will become the new selected interactable. This frustum should be set to a point relative to the wrist instead of the Pointer Pose.
- Optional Deselection Frustum: When set, the Selected interactable must exit this frustum rather than the SelectionFrustum, in order to be deselected. It should be wider than the SelectionFrustum. It also allows interactables to become stickier when no better interactables are within the Selection range. This frustum should be set to a point relative to the wrist instead of the Pointer Pose.
- Optional Aid Frustum: When provided, interactables must be within both the SelectionFrustum and this frustum in order to be eligible for selection. Typically, this frustum originates from the head.
- Aid Blending: This indicates how centered an interactable must be within the Selection or Aid frustums to be selected. Values range from 0 to 1. A value of 0 indicates that the interactable must be within both frustums but it will be scored as centered within the SelectionFrustum. A value of 1 indicates that it is scored better if it is more centered within the Aid Frustum (Gaze selection).
- Detection Delay: This value (in seconds) indicates how long the interactable must remain the best candidate before it becomes selected. Increasing this value helps reduce the chance of a false positive in noisy environments.
As demonstrated in the DistanceGrabExamples scene, the recommended approach for configuring the frustums is to set the Selection and Deselection frustums to a point relative to the wrist (instead of the Pointer Pose). Use FilteredTransforms for the frustum origins to keep the frustums stable while allowing the wrist to turn in order to select nearby interactables.
DistanceHandGrabInteractable
The DistanceHandGrabInteractable is the Interactable class of this interaction. It uses the same fields as the
HandGrabInteractable. Additionally, it will copy those fields when you add it to a GameObject that already has a configured HandGrabInteractable component attached.
The versatility of the DistanceHandGrabInteractable is provided by the
Movement Provider field, which indicates how the interactable moves when selected. If no value is provided, the interactable will move toward the interactor, and then attach to it and move in sync with it. Other behaviors are also provided (and additional behaviors can be created by implementing
IMovementProvider). These can be found in the
Movements folder, but some of the most relevant ones include the following:
- MoveTowardsTarget: Attaching this behavior as a component allows tweaking the different parameters such as easing curve or velocity. For more information, see the Interactable Movements section.
- AutoMoveTowardsTarget: This behavior is similar to MoveTowardsTarget but this behavior will finish the movement toward the interactor even if the selection is interrupted. This behavior is useful for quickly attracting multiple objects toward the user.
- MoveFromTarget: This behavior does not attract an object toward the interactor, but rather it anchors the object at the interactor pose, allowing the interactor to move it a distance.
- MoveAtSource: This moves the interactable at its current position, but does so using the delta movement of the interactor, as if the hand jumped automatically to the interactable position and moved it from there.
For reference information about the components used by distance hand grab, see the following links.