Forum Discussion
fancyfennec
9 years agoExplorer
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
- vrdavebOculus StaffYep. Use the Oculus Utilities for Unity, add an OVRManager to your scene, and call OVRManager.tracker.GetPose(). Alternatively, use OVRCameraRig in your scene instead of a plain Camera and check the Transform OVRCameraRig.trackerAnchor.
- fancyfennecExplorerI'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
- vrdavebOculus StaffOVRCameraRig.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.
- fancyfennecExplorerok. 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.
- vrdavebOculus StaffThe 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.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 4 years agoAnonymous