Is it possible to recenter the camera in WebXR?

Hello, is it possible to recenter the camera in WebXR?

I would like to have the option to recenter the headset to the new user position like others platform does like SteamVR etc

my only guess will be to move the Entire scene to the user position, but I dont see a way to do that

cc @RaananW


When you say recenter, do you mean reset the rotation to make the user look at some default direction?

@RaananW yes but also position, not sure how to explain, but exactly the behavior that has SteamVR, lets say i started the session, i moved a bit to the right and rotated as well, i recenter, now my new origin will be this position, my best guess will be that you move all the Scene to the new user position and forward direction

this is an example, unfortunately this video just rotate the head, but you can see which option i refer to and try it? How to re-center SteamVR (updated July 2020) - YouTube

What’s the difference between this and setting your position to the position you want to be at?

** EDIT - sorry, I feel like this answer might have portraited the wrong attitude :slight_smile: I am really trying to understand what the difference is. Technically it is the same, but I guess there is something I am missing. Is it really just the fact that the “world camera position” is now 0,0,0?

@RaananW yeap sorry probably is tricky to explain,

as my example before, lets say i started the game, my origin is 0,0,0, i move a little to the right, and now my position is 10,0,0 , i think you are suggesting, why shouldnt i just move to 0,0,0 again right? and i be again in the origin of my game,

but that is not what i want to do, what a want to do, is that, ok i am now at 10,0,0 and i want to convert that position to my new origin 0,0,0, like “apply transform” in blender

So it is, in general, a way to “reset” your transformation in your current transformation. I get it now.
I don’t mind looking into it. It is more than possible - webxr provides this functionality. We use it internally to move the user around when you are teleporting, for example.
Do you want to submit a github issue?

Yeap sure thanks!, here is the link add option to recenter the camera in WebXR · Issue #12875 · BabylonJS/Babylon.js · GitHub


This doesn’t seem to have been worked on. I tried looking through the camera teleport code and didn’t find any webxr functionality used. Would you be able to provide some guidance on what webxr functionality we can use to “reset” the world?

I also have the case where I need to reset the rotation of the camera so that the current direction becomes the new “forward” normal. would the webxr functionality accomplish this too the same way the steamvr/oculus reset does?


it hasn’t been worked on, as this is relatively a low priority at the moment. If I understand you correctly, you want the camera’s rotation to be reset but still look forward? Can I ask for the actual use case? I mean - why is it needed?
The platforms offer rotation reset (usually a hardware button, like the left menu button in quest). Is that enough?

The first Use-Case that comes to my mind is seated VR. Often, in a driving or flight game, you’re supposed to remain in a very specific position, such as the cockpit. The headset’s orientation and position will drift over time and periodically needs to be reset to center you back to your position.

On an Oculus headset, a long-press of the Oculus button performs a “reset orientation and position”. This article shows the Oculus way. However, running around in this playground I find that after only a short time, my view has a definite tilt to the right. And the Oculus reset does not resolve it.

Unreal Engine has a specific call for this: Unreal Engine 4.26 node

My friend Justin also has a great video tutorial on how this can be achieved in Unity.

Thank you Corysia

Yes the hardware button on the Oculus should reset but it does not resolve the issue. This was happening while I was working / developing from a seated position. The gameworld would drift and eventually “forward” would no longer be the direction I was sitting and facing and the camera position would be slightly off. So moving in and out of the VR space I’d have to uncomfortably twist in my chair to have the VR camera face the correct direction.

I’ll see if I can create a playground that displays the coordinates and direction angle so we can see how off baseline the twist becomes.

Thanks again!

1 Like