Skip to main content
Participant
December 8, 2016

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?
    This topic has been closed for replies.

    4 replies

    Inspiring
    December 8, 2016
    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);
    }
    }

    levi777lAuthor
    Participant
    December 8, 2016
    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!
    Inspiring
    December 8, 2016
    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.
    levi777lAuthor
    Participant
    December 9, 2016
    Done =P