Forum Discussion
MELT
11 years agoHonored Guest
Fixing position of positional tracker in virtual space Unity
Hi guys! I'm trying to make a site-sepcific, sitting installation where the positional tracker will always be in the same place and there will be some real-world scale unmovable surroundings to tou...
vrdaveb
10 years agoOculus Staff
"MELT" wrote:Yes, you need to move the tracking reference frame so that the virtual tracker lines up with the physical tracker. The origin and basis vectors of our tracking space space are the initial pose of your head when the app starts, but the x and z rotation are set to be parallel to the floor to avoid tilting the whole world. When you call InputTracking.Recenter(), it moves the origin to your current head position and changes the yaw to match your current head yaw. This is known as "eye level" tracking. As of Oculus SDK 0.8, we always report the poses of your head, eyes, and tracker relative to the "eye level" origin. OVRCameraRig.trackingSpace is always at that origin. If you move trackingSpace, all the other anchors will move to follow it. So if you want the trackerAnchor to be at a specific pose, move trackingSpace to the inverse of that pose with code like the following:
It'd be best to position the tracker in virtual space in Unity mirroring the real world
using UnityEngine;
public class TrackerToOrigin : MonoBehaviour
{
public OVRPose origin = OVRPose.identity;
public bool useWorldSpace = true;
void Awake()
{
var rig = GameObject.FindObjectOfType<OVRCameraRig>();
rig.UpdatedAnchors += OnUpdatedAnchors;
}
void OnUpdatedAnchors(OVRCameraRig rig)
{
var oldPose = rig.trackerAnchor.ToOVRPose(!useWorldSpace);
var offset = origin * oldPose.Inverse();
if (useWorldSpace)
offset = rig.transform.ToOVRPose() * offset;
rig.trackingSpace.FromOVRPose(offset, !useWorldSpace);
}
}
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
- 5 years agoAnonymous