- Home /
Oculus Rift Track where the left palm goes
Hello, I am trying to figure out a way to get the direction the left palm moves in. Here's what I have basically:
When the left index trigger is pressed, you stamp the location.
if (OVRInput.Get(OVRInput.RawButton.LIndexTrigger) && !isLeftIndexPressed)
{
isLeftIndexPressed = true;
Vector3 temp = leftHandAnchor.transform.TransformPoint(OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch));
leftIndexPressLocation = transform.InverseTransformPoint(temp);
}
else if (!OVRInput.Get(OVRInput.RawButton.LIndexTrigger))
{
isLeftIndexPressed = false;
}
Then, while you're holding the left trigger, you get the delta.
Vector3 temp = leftHandAnchor.transform.TransformPoint(OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch));
Vector3 CR = transform.InverseTransformPoint(temp);
Vector3 LdeltaLocation = new Vector3(CR.x - leftIndexPressLocation.x, CR.y - leftIndexPressLocation.y, CR.z - leftIndexPressLocation.z);
However, I don't exactly know how to tell which way the palm is facing while doing this. I basically want to move an object in this tracking space by the amount of LdeltaLocation in the direction the palm is facing.
Thanks in advance for the help :)
Answer by bigvalthoss · Feb 25, 2021 at 08:41 PM
Hello, So I was able to get the direction the palm is facing for any given hand by using:
Vector3 wSpaceDir = OVRTrackingSpace.transform.TransformDirection(LeftHandAnchor.transform.right);
controlClipDimsWithPalmDirection(wSpaceDir, true);
However, It seems to do the opposite of what I want it to do when I turn 180 degrees. It also acts weirdly when I turn 90 degrees in any direction. Any help is appreciated :)
Thanks!
Finally figured it out... Here is the code:
Quaternion tempQua = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch);
Vector3 localPalmDir = tempQua * Vector3.right;
Vector3 wSpaceDir = OVRTrackingSpace.transform.TransformDirection(localPalmDir);
Your answer
Follow this Question
Related Questions
oculus, gui and menu not showed correctly 0 Answers
| DK2 Not Stereoscopic | Unity 5.1.2 | 1 Answer
(Oculus SDK) How to change hand color? 1 Answer
Emulate Oculus Rift 0 Answers
direct to rift dosent display scene 1 Answer