Skip to main content
Version: 0.23.2

Snapping

The purpose of this feature is to create physically constrained poses to make catching virtual elements coherent. The idea is to adjust the hands and fingers rotations so that they best fit the catching object. Those poses are associated to selection gestures such as grab or pinch.

When the user makes a selection gesture while colliding an object, the virtual hand will snap as configured on it.

Description

XR Hand Interactable Snap Pose Provider

By adding an XR Hand Interactable Snap Pose Provider component under an XR Grab Interactable object in the Hierarchy, a snap pose may be provided for the interactable. One or several XR Hand Interactable Snap Pose with different scales can be created under the XR Hand Interactable Snap Pose Provider. The Snap Pose Provider can then interpolate between all snapping poses based on the current hand scale. When the interactable is grabbed, the interpolated pose for the current user hand scale will automatically be applied on the object.

tip

The hand scale is clamped between 0.5f and 1.6f.

XR Hand Interactable Snap Pose

A snap pose allows defining an exact position on the object for the hand to snap to.

By editing the transform and hand joint rotations, developers can set up the pose for a specific hand scale. The hand scale is defined by the x scale value of the snap pose transform.

By default snap pose data are serialized on the game object itself. The pose can be exported and use as reference by clicking on the export button. If the hand pose ref field is set, data will be serialized in the referenced hand pose asset. To apply a reference hand pose data to the snap pose object serialization, click on Apply pose inspector button.

danger

Editing hand joints from a hand pose reference will serialize data in the hand pose asset. All snap pose referencing this hand pose asset will be altered consequently.

Integration step by step

  1. Add an XR Hand Interactable Snap Pose Provider object as a child of the interactable object. Select Handedness of the snap pose provider. Create two snap pose providers, one for each hand, to perform both hand snapping. If some fingers can stay unsnapped when the interactable is grabbed, change the mask field from required to free for those fingers.
tip

Once a provider and poses are set for one hand, duplicate the provider, change handedness, flip poses and adjust tranforms to quickly get the mirrored snap pose provider for the other hand.

  1. Add an XR Hand Interactable Snap Pose object under the XR Hand Interactable Snap Pose Provider object.

  2. Set the pose and scale of the snap pose with the transform tool, and edit hand joints by clicking Edit joints button.

danger

Use uniform scale for each axis. Only x scale value will be used by the XR Hand Interactable Snap Pose Provider to sort snap poses.

  1. Add the snap pose in the provider poses list.
  1. Repeat adding XR Hand Interactable Snap Pose with different scales.

  2. Review the pose interpolation by changing the scale using the scale slider on the XR Hand Interactable Snap Pose Provider component.