Added height when using the Oculus Go with the VR Starter project template

So I was playing with the VR Starter project and it works fine with the Oculus Rift but I tried to use it with the Oculus Go and it seems to add some extra height to the camera.

I saw around line 40 in look-camera.js the following:

if (appVrDisplay.capabilities.hasPosition) {
            if (this._hasStageParams) {
                var pos = this._offsetParent.getPosition();
                this._offsetParent.setPosition(pos.x, pos.y - LookCamera.DEFAULT_HUMAN_HEIGHT, pos.z);
            }
        }

This seems like this is supposed to be active for the Oculus Go but it isn’t.

Is there a workaround to detect if the headset is adding height to the camera?

EDIT: This happens when using the Oculus browser, Firefox does not have this issue.

Thank you!

WebVR still has problems with inconsistent results from APIs across browsers.

I would check around the Oculus browser docs to see if they have any extra flags or APIs to check if the headset has position data or something that allows to check against this browser.

Thank you!

Is there a way I can force the camera to stay in the predefined height regardless of the device when VR is active? I am working on a scene for the Oculus Go that does not require position tracking, but even when I deactivate look-camera.js the camera still adds the extra height.

Not without patching the engine code to ignore the VR headset’s positional data.

I see, thanks.

So it seems that appVrDisplay.combinedPos.y will return the added height.

I tried adding this._offsetParent.setPosition(pos.x, pos.y - appVrDisplay.combinedPos.y, pos.z); at the end of initialize but it seems that the vec3 at appVrDisplay.combinedPos won’t get updated until later.

What would be a good place to apply the offset?

EDIT:

This did the trick but I am sure theres a better way XD

var adjusted = false;
LookCamera.prototype.update = function (dt) {
    
    if (!adjusted && this.app.vr && this.app.vr.display) {
        
        console.log(this.app.vr.display.combinedPos.y);
        var pos = this._offsetParent.getPosition();

        if(this.app.vr.display.combinedPos.y > 0) {
            this._offsetParent.setPosition(pos.x, pos.y - this.app.vr.display.combinedPos.y, pos.z);
            adjusted = true;
        }
    ...