This blog post is the continuation of the previous post where we've learned about adding hand interactors and interactable objects that can be manipulated using just one hand. If you haven’t checked out the first part of this series, we highly recommend checking it out.
In this blog, we’ll learn about two things. To create objects that can be interacted with two hands and to create objects with physics.
Generally, we’ll use two hands to scale an object. This type of interaction can be used to represent a heavy object as well i.e. requiring both the hands to pick up something heavy. So to create such an object:
You can test the scene and see the difference, it feels more natural now.
With that, we have completed two hands interaction.
We all know how physics works on a GameObject with a Rigidbody component. But when it comes to hand interaction, interacting with such an object is not possible. Because every time we try to grab it, the object will fall. There has to be some way the physics gets disabled when interacting with a hand and enabled when released. And that’s done with the help of the Physics Grabbable component. So to create an interactable object with physics:
Note: For better grab interaction, we can select the Collision Detection parameter of the Rigidbody component as Continuous. So that even if the hand is moving fast towards to grab it collision detection will be detected even if the collision occurs between two FixedUpdate steps.
With that, we have learned to create objects with physics.
We can create objects that can be either interacted with one hand or two hands, we just need to make sure all the required components are attached to that object. It’s amazing when you can grab an object, resize it with two hands and throw it around. One of the applications I can think of is puzzles where you can resize a key to fit it correctly into a lock. In the next part, we’ll learn about rotational transforms and recording hand poses.
If you've enjoyed the insights shared here, why not spread the word? Share the post with your friends and colleagues who might also find it valuable.
Your support means the world to us and helps us create more content you'll love.