Head Position in VR World Space vs Real World Space

Is it possible (per frame) to find the head position and orientation in real world space and separately in virtual world space? I basically want to write an extension to find out how much the player’s body position and orientation has changed regardless of changes to head position/orientation. Ie, how much has the game moved/re-oriented the player per frame. Thanks!

It’s not possible from information available through OpenXR at least. The tracking systems only know of poses relative to the real world space. The game itself handles transforming the poses to the virtual space, and then back to view relative poses when rendering. Nothing about the virtual space gets exposed through the API.

Technically you could write an extension that games can opt into and provide the pose data, but that would require explicit support from each game.

I found this, and thought maybe this would give me the VR world space position and orientation…

XrView  view; 
XrSession session = ...; // Your OpenXR session 
xrEnumerateViewConfiguration(system, session, 1, &view, nullptr); 
XrPose pose = view.pose; 
float playerX = pose.position.x;
float playerY = pose.position.y;
float playerZ = pose.position.z;

I actually thought it would be getting the REAL world co-ordinates that would be more difficult.

That looks a non-existent function. The closest matching one is xrLocateViews, which is used by the game to get the eye poses to render to.

The concept of a virtual world space doesn’t exist in OpenXR (or any other XR API AFAIK). It’s entirely handled inside the game.

Really appreciate the insight, thank you. I guess a need to go up a level and somehow try and interrogate the game engine to find the player position. Thank you!

1 Like