Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity wants to learn about your experiences working on a Unity project today. We'd like to hear from you via this survey.
    Dismiss Notice
  3. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  4. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  5. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Resolved Oculus Rift Track which direction the palm is facing in world space

Discussion in 'VR' started by bigvalthoss, Feb 25, 2021.

  1. bigvalthoss

    bigvalthoss

    Joined:
    May 26, 2020
    Posts:
    16
    I am trying to track which direction the palm of the controller is facing in world space, but I'm having trouble. Here is the code I am currently using:

    Code (CSharp):
    1. Vector3 wSpaceDir = OVRTrackingSpace.transform.TransformDirection(LeftHandAnchor.transform.right);
    2. Debug.Log("LHDir in world space from hand: " + wSpaceDir);
    The problem is that when you turn around, the tracking stays in reference to me. Meaning it will always say (1.0,0,0) if I have my hand straight in front of me but turn around in any direction. Any help greatly appreciated :).

    Thanks!
     
  2. bigvalthoss

    bigvalthoss

    Joined:
    May 26, 2020
    Posts:
    16
    Finally Figured it out.. Here is the code:
    Code (CSharp):
    1. Quaternion tempQua = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch);
    2. Vector3 localPalmDir = tempQua * Vector3.right;
    3. Vector3 wSpaceDir = OVRTrackingSpace.transform.TransformDirection(localPalmDir);
     
unityunity