Recentering headset from the application running OpenXR

Hi,

I’ve almost completely ported an application to the OpenXR standard from OpenVR (I must say it works much better and smoother!)

The only thing I still need to do is recentering the headset position from the application itself.

In OpenVR it was done by calling to:

vr_chaperone_->ResetZeroPose(vr::ETrackingUniverseOrigin::TrackingUniverseSeated);
vr_compositor_->SetTrackingSpace(vr::ETrackingUniverseOrigin::TrackingUniverseSeated);

But I cannot find either in this forum or in the documentation a similar way to do it in OpenXR.

I have a poseSpace as follows:

XrReferenceSpaceCreateInfo referenceSpaceCreateInfo{ XR_TYPE_REFERENCE_SPACE_CREATE_INFO };
referenceSpaceCreateInfo.poseInReferenceSpace = { {0.0f,0.0f,0.0f,1.0f},{0.0f,0.0f,0.0f} };
referenceSpaceCreateInfo.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_LOCAL;
CHECK_XRCMD(xrCreateReferenceSpace(m_session, &referenceSpaceCreateInfo, &m_poseSpace));

To get the view position and pass it to the simulation renderer. Maybe I should recreate this xrSpace with some special parameters at the moment of resetting the view?

Could anyone please tell me about how to achieve this goal?

Thank you very much in advance!

Kind regards!

You can re-create the reference space indeed, using the current pose as the poseInReferenceSpace for the new space. This should effectively act as recentering.

1 Like

Here is a nicer explanation actually

1 Like

Thank you very much for the quick answer !!

Also for the OpenXR cookbook. I had no idea of the existance of this cookbook. Most of my sources for the migration have been the hello_xr sample, this forum and ChatGPT :sweat_smile:

All my kudos to you mbucchia! :slight_smile:

Greatly appreciated! :slight_smile:

That cookbook thing has no other content unfortunately… this is something my team started a while ago but then we had no resources to pursue.

Khronos is currently working on something much better, but not published yet!

1 Like

Thanks for the info! Looking forward for that book whenever published.

With your indications it has been quite straight forward to implement headset position reset. I’ve already achieved it :slight_smile:

Thanks again for everything and, in particular, for your contributions to OpenXR (OXT, VD OXR driver,…)

1 Like