Hello there, am new to unity and am developing an AR android app using Manomotion package for hand detection and Gesture recognition
my goal is to grab a 3D object with my hand and change its position to according to a known point of my hand “Cursor”.
I got to the point where I can grab the right object and start moving it, but the problem is as follow:
1- the cursor coordinates values are between [0,500] for X and between [0 , 1500] for Y and the 3D object coordinates values are between [0 , 0.5] for X and [0 , 1.5] for Y (of course theses values are different from one mobile to another but that’s not the point), so I have to divide the cursor coordinates values by 1000 so the 3D object would still appear on screen.
2- when moving the 3D object it would have the exact same values of the cursor but they are not on top of each other.
here is my code:
void MoveCube(TrackingInfo trackingInfo)
{
Handheld.Vibrate();;
posOfCube = Camera.main.ViewportToScreenPoint(trackingInfo.palm_center);
posOfCube.x = posOfCube.x/1000;
posOfCube.y = posOfCube.y/1000;
currentlyCapturedCube.GetComponent<Transform>().position = posOfCube;
}
Here am supposed to be grabbing the lager cube and it’s supposed to be placed on top of the white circle (the cursor).
sorry for the long question and thanks in advance.