Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
levi777l's avatar
levi777l
Explorer
9 years ago

Multiple sensors in unity

The OVR Camera rig only has a anchor point for one sensor, how can I find the position of the rest?

4 Replies

Replies have been turned off for this discussion
  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    Use OVRTracker.GetPose(..). Example:

    using UnityEngine;
    using System.Collections;
    using VR=UnityEngine.VR;

    public class OVRTrackedNode : MonoBehaviour
    {
    public enum Node
    {
    Head           = VR.VRNode.Head,
    EyeLeft        = VR.VRNode.LeftEye,
    EyeRight       = VR.VRNode.RightEye,
    EyeCenter      = VR.VRNode.CenterEye,
    HandLeft       = VR.VRNode.LeftHand,
    HandRight      = VR.VRNode.RightHand,
    TrackerZero,
    TrackerOne,
    TrackerTwo,
    TrackerThree,
    }

    public VR.VRNode node;
    void Update()
    {
    int trackerIndex = (int)node - (int)Node.TrackerZero;

    OVRPose pose;
    if (trackerIndex >= 0 && trackerIndex <= 3)
    {
    pose = OVRManager.tracker.GetPose(trackerIndex);
    }
    else
    {
    pose.orientation = VR.InputTracking.GetLocalRotation((VR.VRNode)node);
    pose.position = VR.InputTracking.GetLocalPosition((VR.VRNode)node);
    }

    transform.FromOVRPose(pose, true);
    }
    }

  • Interesting, I found the answer and couldn't delete my post, so I edited it and asked a different question I had.  =P  Thanks tho!
  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    Any chance you could go back to the previous question in this thread and make a new thread for the new question? Other developers may benefit from the context.