Throw an Object
In this tutorial, you learn how to throw a cube with Interaction SDK using physics and hand grab interactions. If you have v65+ of Interaction SDK, this tutorial is obsolete because all grabbable objects are throwable by default.
In order to make the cube throwable, it has to respond to physics and an interaction (which in this tutorial is hand grab).
In the Hierarchy, add a cube GameObject by right-clicking and selecting 3D Object > Cube.
In the Hierarchy, right-click and select 3D Object > Plane so the cube has a surface to sit on.
Without the plane or another surface to sit on, the cube will fall out of reach when the scene starts.
- Under Inspector, click Add Component and then search and add each of the following components:
- Physics Grabbable
- RigidBody
- Grabbable
- Hand Grab Interactable
- In the Transform component, set the Position axis values to the following.
- In the Scale field, set the axis values to the following.
In the Physics Grabbable component, set the Pointable field to Cube. If prompted to pick a component, choose the Grabbable component.
In the Physics Grabbable component, set the RigidBody property to Cube.
In the Hand Grab Interactable component, set the Physics Grabbable property to Cube.
Position the cube just above the Plane.
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.
Select File > Build And Run, or if you have a Link connected, click Play.
You can now grab and throw the cube. The cube inherits the velocity provided by a velocity calculator prefab, which is included with the OVRInteractionComprehensive rig as a child of each hand’s HandGrabInteractor GameObject.