Create a Hand Grab Pose (Mac)
In this tutorial, you learn how to record a custom hand grab pose with Interaction SDK to control how your hands conform to a grabbed object. Once you record a pose, you can adjust its fingers and scale, mirror, and enable it to work with different surfaces.
Hand grab poses adjust how your hand grabs an item, so your scene should have a grabbable item.
Open the Unity scene where you set up the camera and hands.
Under Hierarchy, create an empty GameObject named Item by right-clicking and then selecting Create Empty.
Add a Sphere to Item by right-clicking Item, and then selecting 3D Object > Sphere.
Under Hierarchy, select Sphere.
Under Inspector, in the Transform component, in the Scale property, set the X, Y, and Z values to 0.1.
Under Hierarchy, select Item.
Under Inspector, add a Rigidbody component by clicking the Add Component button and searching for Rigidbody.
In the Rigidbody component, check the Is Kinematic property.
Under Inspector, add a Grabbable component so you can grab the sphere.
In the Project window’s search bar, search for HandGrabInteractable. Ensure the search filter is set to either All or In Packages, since the default setting only searches your assets.
Drag the HandGrabInteractable prefab onto Item in the Hierarchy.
Your hierarchy should look like this.
Now that your scene contains a grabbable object, you can customize how the hand conforms to the object during a grab.
Under Hierarchy, select HandGrabInteractable.
Under Inspector, in the Hand Grab Interactable component, click the Add HandGrabPose Key with Scale 1.00 button to add a pose that’s scaled to the default hand size.
A ghost hand appears in the scene view, and under Hierarchy, a HandGrabPose is added as a child of HandGrabInteractable.
To ensure your hand grabs the item correctly, you need to manually adjust the pose’s position and fingers.
Under Hierarchy, select HandGrabPose.
In the scene view, wrap the hand to the item using the transform gizmos and each finger’s joint handles (the blue circles within each finger).
Adjusting the pose using the transform gizmos and finger joint handles.
Under Inspector, in the Hand Grab Pose component, in the Fingers Freedom property, pick either Free, Constrained, or Locked for each finger (the pinky finger is listed as Max).
- Free: The finger moves freely.
- Constrained: The finger won’t move past its position in the pose.
- Locked: The finger won’t move.
Add scaled copies of the pose
Because people have different sized hands, you should add scaled copies of the pose to account for larger or smaller hands. You can make as many scaled copies as you want, but to account for most hand sizes, add a 0.70 sized hand pose and a 1.30 sized hand pose.
Under Hierarchy, select HandGrabInteractable.
Under Inspector, in the Hand Grab Interactable component, adjust the Scaled Hand Grab Pose Keys slider to 0.70 (the average child’s hand size).
Click the Add HandGrabPose Key with Scale 0.70 button.
A ghost hand appears in the scene view, and under Hierarchy, a HandGrabPose is added as a child of HandGrabInteractable.
Repeat the
Adjust the Pose section for the new
HandGrabPose since it’s smaller than the original
HandGrabPose you added.
Your pose now fits all hand sizes between the sizes of your two poses (0.78 to 1.00). Dragging the Scaled Hand Grab Pose Keys slider between those points shows the pose automatically scaling to the specified hand size.
The pose auto-scaling between the two pose keys.
Repeat this section with the Scaled Hand Grab Pose Keys slider set to 1.30 to accomodate larger hands.
By default, when you grab an object, your hand snaps to the position of the pose. To grab the object from other angles, add a grab surface to the pose.
Under Hierarchy, select HandGrabPose.
Under Inspector, add a Sphere Grab Surface component by clicking the Add Component button and then searching for Sphere Grab Surface. This component allows the hand to conform to your custom pose and grab the object from multiple angles based on the shape of a sphere.
If your object is a different shape and you want a custom grab surface, use the component from this list that matches your shape.
- Bezier Grab Surface
- Box Grab Surface
- Collider Grab Surface
- Cylinder Grab Surface
- Sphere Grab Surface
In the Hand Grab Pose component, set the Surface property to HandGrabPose by dragging HandGrabPose from Hierarchy into the field.
Repeat these steps for the remaining HandGrabPose GameObjects so they can also grab the object from multiple angles.
Note
At the very bottom of the Hand Grab Pose component, you can click the Follow Surface button to preview grabbing the object from multiple angles.By default, hand grab poses are created for the left hand. To use them for the right hand, duplicate the pose.
Under Hierarchy, select HandGrabInteractable.
Under Inspector, at the very bottom of the Hand Grab Interactable component, click the Create MirroredHandGrabInteractable button.
A HandGrabInteractable_mirror GameObject is added to the Hierarchy.
Prepare to launch your scene by going to File > Build Settings and clicking the Add Open Scenes button.
Your scene is now ready to build.
Build and run your scene.
In your scene, grab the object.
Your hands can now grab the object from any angle.
The player’s hands grabbing the object with a custom pose from multiple angles.