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 user's hand scale. When the interactable is grabbed, the interpolated pose for the current user hand scale will automatically be applied on the object.
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 should be uniform and will refer to the x scale value of the snap pose transform.
Snap poses data are serialized on the GameObject itself. Though a pose can be exported as an asset by clicking on the Export pose button. Therefore this pose can be reused as copy to setup other hand poses. By clicking on the Import pose button, hand pose data will be apply to the GameObject and serialized as well.
Integration step by step
- 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.
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.
Add an XR Hand Interactable Snap Pose object under the XR Hand Interactable Snap Pose Provider object.
Set the pose and scale of the snap pose with the transform tool, and edit hand joints by clicking Edit joints button.
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.
- Add the snap pose in the provider poses list.
Repeat adding XR Hand Interactable Snap Pose with different scales.
Review the pose interpolation by changing the scale using the scale slider on the XR Hand Interactable Snap Pose Provider component.