Hand Tracking - Drag and Drop 3D item

Hi everyone,

I’ve test the Gallery and it’s awesome. I want to use the drag and drop but not on images. I have some 3D items and I want to Drag and Drop them but I dunno how to do that. It’s super hard to split all the script etc.

Thanks for your help everyone,

Using the scripts from the gallery in their original form is not an option, since the gallery works on canvas.
You need to create a component that will check whether the hand pointer is on the object (projection on the screen space), and capture it by drag and drop.
There is a similar implementation for the mouse cursor; with some minor changes it can be adapted for two pointers: https://www.youtube.com/watch?v=0yHBDZHLRbQ
Input.mousePosition will be replaced with the current hand pointer position;
EventSystem.current.RaycastAll will be replaced with RayCast in Camera.ScreenPointToRay (https://docs.unity3d.com/ScriptReference/Camera.ScreenPointToRay.html);
ImageItem will be replaced with GameObject (more precisely, with Collider after the Raycast operation);
OnMouseDown / OnMouseUp / OnDrag will become public and will be called by the pointer module (now for the user interface, it calls OnPointerDown / OnPointerUp / OnDrag) (https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnMouseDown.html).