Reset VR Position on OpenXR

Hi there, recently moved my project to 4.27 and chamged the plugin to work win recent OpenXR. I’ve Character with capsule root component instead the simple VR Pawn of the template, and haven’t found the way to rotate in right way (snap turn), always over the capsule, in the past solved it with Reset Orientation and Position function, but looks like is not available already for OpenXR (like no response). Any idea if will work again or gonna be new one valid for OpenXR? or how to solve the snap rotation over the camera

Is your HMD calibrated correctly? It sounds like the software is working as intended, but your HMD has an offset origin point. This should be solved in SteamVR, WMR Home or Oculus Home outside of UE4.

Yeah I understand, but is normal a player loose de VR origin so for example if you walk naturally inside the guardian/chaperone you can turn over current camera location. If you create default template for VR there is the example for turn snap. But if converted to character (with collision capsule like root + other components) doesn’t response as well. I’m trying to modify the blueprint for my case, suppose need calcs for final actor location and rotation offset. Before was easier just calling Reset Orientation and Position function like commented, camera set current location to VR Origin

OK I get it, first of all added world offset to the capsule to the camera world location, then scene component is parented the camera set like the capsule world location (for both be at same position).
Then add relative rotation to the scene component (parent of the camera)
And finally add worldoffset to parent scene component taking the difference between capsule component getworldlocation and camera getworldlocation

Reset orientation and Position function is being worked on for OpenXR and will hopefully make it into 4.27.1.

That said, you can look at the new VR Template in 4.27 if you need a reference on how to snap turn.

2 Likes

Thanks Victor, like commented get it taking reference from VR Template, although was little more complicated than VR Template, to be based on Character instead regular pawn (child of capsule). Hope Reset Orientation and Position back to handle it easier that kind of chores. Thanks for the response.

I have to notice that VRNotificationsComponent doesn’t incorporate with OpenXR. OpenXR doesn’t use any Core delegates which VRNotificationsComponent binds to. Is there any plans to support these VR core delegates with OpenXR?

We’re on 4.27.2 and still no fix.

void FOpenXRHMD::ResetOrientation(float Yaw)
{
}

void FOpenXRHMD::ResetPosition()
{
}

void FOpenXRHMD::SetBaseRotation(const FRotator& BaseRot)
{
}
1 Like

Any news on that? In ue5-main it’s still not implemented. That feature is really needed for any vehicle simulation in VR.

From what I understand, the feature just applies a transform on every thing on the engine side, as opposed to something like the SteamVR Reset Seated Position command (which doesn’t have any equivalent in the OpenXR spec).

It should be fully implementable directly in the player pawn by applying the same transform to the tracked components inside it.

Thanks for the tip, but I can’t get that working. I’ve tried moving both the pawn’s camera and the player camera manager, but neither works at runtime. Moving the camera at editor time obviously works, but that doesn’t solve the runtime position reset requirement.

I’ve checked FSteamVRHMD::ResetPosition(), and it works by applying the offset at the lowest level, and I’m not sure you can just to a similar thing at a higher level (e.g., pawn).

Also, is OpenXR’s SetTrackingOrigin(EHMDTrackingOrigin::Type NewOrigin) supposed to be working? Because it’s not, whatever you set it to, it sets the tracking origin to Floor. I hoped setting it to Eye would be a workaround for our use case (in-vehicle VR), but since it doesn’t work, we’re kinda stuck. SetTrackingOrigin works in SteamVR by the way.

[EDIT: SetTrackingOrigin(EHMDTrackingOrigin::Type NewOrigin) seems to be working with OpenXR, at least on the Vive I got right now. I’ll check tomorrow on my XR-3, but yesterday it wasn’t working]

This really sucks, as it means you can’t use high-end XR headsets (e.g., Varjo XR-3) for in-vehicle simulation, which is the main market for those headsets.

1 Like

Ah sorry, I made a mistake there. The camera and motion controller components automatically update their transforms relative to the tracking origin. To apply a transform to them you can either transform the entire player pawn, or parent the tracked components to a scene component and apply the transform to it.

Edit: Testing it out with the VR Template, I parented the camera and motion controllers to a scene component called TrackingOrigin. Calling this code makes it align the camera with the PlayerStart actor, just like the reset button in any simulator.

1 Like

This is the way

Thank you for the answer.

I’ve tried doing the same thing on the VR template, but without success. If I don’t take any rotation from the camera’s transform (i.e., location only), it works as expected. But if I connect the Z rotation as in your example, it offsets my Z location based on the camera’s Z rotation.

I completely suck at transforms and vectors, so I’m having a hard time figuring out this one myself, but I’ll keep trying.

image

Testing it, it seems like it’s only working when the VR tracking origin is set to Floor Level. The camera component might be adding some extra transform to itself. Switching out the camera component transform for the actual HMD transform seems to make it work properly in both modes.

Using the node: Head Mounted Display → Get Orientation and Position

Once again, thank you for the answer.

Sadly, it still doesn’t work. I was already using Floor Level as tracking origin, as it’s the default for the VR Template, and for now I’m just trying to reproduce your result. Hard to see from the video, but if I look to the right, the reset position will also be offset to the right. Same for left.

Ok I think I solved it, the transform composition needs to be the other way around (i.e., switch wires). Though I’m never too sure about anything involving a matrix, so I might be wrong and I’ll need more testing. Once again, thank you so much for your help, I’d be dead stuck without you.

3 Likes

Glad you got it working!

Seems like I only tested the last one with the player start on the origin. When it’s moved i guess it would factor in the offset of the player pawn. Your fix seems to work correctly on my side as well.

Support for the function in OpenXR is now on main: https://github.com/EpicGames/UnrealEngine/commit/b75743c3f16b760fe6a8b8a29c2a2baf99e266c9

2 Likes

Nice! Will that be reflected back to 4.27.xx or just for UE5 and over?