In this tutorial I am going to explain how to drag & drop Game objects in unity using Kinect. We will select a game-object by gripping hand on object. After selecting game object its shader will changed to yellow color, then we can drag or move game object on our scene. When we release hand cursor (Grip out), the game object will dropped at new position.
Step 1 – Set up Kinect to Unity.
Note – For more details on “How to setup Kinect with Unity”, you can see our blogs
Create a Unity project. We need to import a Unity Asset (Kinect v2 with MS-SDK) that support Kinect.
Now open unity asset store and login in to your unity asset store account if you don’t have create a new account and get the “Kinect v2 with MS-SDK($20)”, and import the package in a new unity project. This package contains some demo scenes and Kinect script which gives the bone orientation and rotation.
Download link – https://www.assetstore.unity3d.com/en/#!/content/18708
After importing unity package. You will see multiple directories inside your Assets folder.
Step 2 – Work with Interaction Demo code.
Go to “Assets / InteractionDemo” folder.
Open “KinectInteractionDemo” scene. There are three game objects there. You can add multiple game-objects to scene.
Now Add another Cube to be scene and renamed to “MyCube”.
Select Main Camera à
Go to Grab Drop Script component à Draggable objects
Assign MyCube gameobject to Element3.
Now click on Play Button.
You can drag drop game objects by Kinect
Thank you for read my blog. If you have any query can write me mail on firstname.lastname@example.org , it would help us a lot.