Unity Native VR - which api call gives floor offset of HMD??
I'm using a tracked pose driver on the camera to gets its unity world position, then I can place/teleport the player by adjusting the camera's parent, but which call do I use the get the physical offset from the HMD to the real world floor? I want to teleport the player while keeping him at the correct height.
Comment
Answer by gp1234567 · Feb 04, 2020 at 02:47 PM
Took a bit to find out because of the 'one-line of documentation should be enough for anyone' vibe, but, here goes:
/*On start:*/
XRDevice.SetTrackingSpaceType(TrackingSpaceType.RoomScale)
//On Main Camera: Add Tracked Pose Driver script
/*Unity Global HMD position:*/ Camera.transform.position/rotation
/*HMD floor offset in Unity units:*/ Camera.transform.localPosition.y