What i wanted to develop is a function to get the local rotation and coordinates of a hand in relation to the camera:
hM2 is the RiggedHand that i want to track
Vector3 positionPalmVector3 = hM2.GetPalmPosition();
Vector3 positionPalmCamVToV3 = MyCoordinateConverter.PosToCamCoord(GameObject.Find("Main Camera").transform, positionPalmVector3);
//Which comes from:
public static Vector3 PosToCamCoord(Transform camTr, Vector3 objPos)
{
return VectorHand.ToLocal(objPos, camTr.position, camTr.rotation);
}
//The other part of my code is:
Vector positionPalmVector = new Controller().Frame().Hand(hM2.GetLeapHand().Id).PalmPosition;
Vector3 positionPalmCamVToV3 = MyCoordinateConverter.PosToCamCoord(GameObject.Find("Main Camera").transform, positionPalmVector3);
//Which comes from:
public static Vector3 PosToCamCoord(Transform camTr, Vector objPos)
{
Vector _objPos = new Vector(objPos);
objPos.z = -objPos.z;
_objPos = _objPos / 1000f;
return VectorHand.ToLocal(objPos.ToVector3(), camTr.position, camTr.rotation);
}
I'm not sure if this can be accurate since i dont really understand Quaternions well. May i have some aid with this?