Forum Discussion

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

Sensor position

Hi, is there a way to find out where the sensor is located in C#?  I want to determine if the sensor is located on the left or right of the player. I have a brief moment where I want the player to turn around and I would rather have them do it toward the sensor as opposed to "opposite" of the sensor, for tracking purposes. Thank you.

5 Replies

Replies have been turned off for this discussion
  • I've never used data from the OVRManager before and I do not know how to integrate this practically in a script. I looked online but couldn't find examples of what I'm looking for. Do you have an example of how tracker.GetPose would be used to tell if the sensor is on the left or right side of the player? Thanks
  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    OVRCameraRig.Update has an example use of OVRTracker.GetPose(). Basically, make a parent GameObject for your Camera, set the Camera's initial local position and rotation to 0, add a sibling GameObject for the sensor, and add a script to that GameObject that sets transform.localPosition and localRotation to the position and orientation of the OVRPose returned by OVRTracker.GetPose() each frame.
  • ok. thanks,. it's a bit over my head but I'll take a look at OVRCameraRig.Update   I wish there was a C# full demo script of that somewhere, Not a whole lot of recent examples online. A lot of old ones.
  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    The simplest solution is probably to disable your existing Camera and use the OVRCameraRig prefab instead. That includes an anchor for the sensor that you can use without needing any code.