XR Floor Position Native Unity

Hi
Just noticed the Scripting Reference doesn’t pick up the in-code ObsoleteAttribute tags I added. Will work to get those added to the scripting reference, since that is the first places users may look.

You are on the right track: In order to get the floor height, you need to set the device’s origin to the floor. That way the 0,0,0 point of the device is no longer wherever the device was at the last Recenter or on App Start, but is located somewhere on the floor.

Once set, you can deduce the player’s height by asking them to stand and getting the device’s Y-height. At least that is the height of his eyes.

As we are moving to the new Plugin Architecture , we now use a concept of Subsystems. In this case, the XRInputSubsystem has a concept of TrackingOriginMode. Someone just linked a quick example of setting the XRInputSubsystem’s TrackingOriginMode: https://discussions.unity.com/t/732331 page-2#post-5438118

Rewritten for Floor:

List<XRInputSubsystem> subsystems = new List<XRInputSubsystem>();
SubsystemManager.GetInstances<XRInputSubsystem>(subsystems);
for (int i = 0; i < subsystems.Count; i++)
{
   subsystems[i].TrySetTrackingOriginMode(TrackingOriginModeFlags.Floor);
}

TrackingOriginModeFlags has 3 settings:
Device places the origin at scene start position and Yaw.
Floor picks a spot on the floor, SDK set but normally the center of the tracking boundary as the Origin. Recenter may change the Yaw or position, but the Y=0 will always be the floor.
TrackingReference uses a fixed tracking object as the origin, think tracking sensor. Probably not something you need to worry about at this time.

Let me know if this gets you back on track!

1 Like