HTC Vive Pro wrong Height after entering VR

Hi,

I have a problem with the HTC Vive Pro on Firefox Win10.
when entering VR for the first time, it seems to start with the wrong height.
The devicePosition.y value contains 2.39.

After teleporting to another location, the devicePosition.y gets set to the correct 1.67.

The Oculus Rift seems to not have this issue.

Am I doing something wrong?

Playground Link:
https://www.babylonjs-playground.com/indexStable.html#NKLPD7#11

Logs:

Babylon.js v4.0.3 - WebGL2

After starting application:

positions: index.js line 556 > eval:33:29
scene.activeCamera.position: {X: 0 Y:1.7 Z:0} index.js line 556 > eval:34:29
vrHelper.position: {X: 0 Y:1.7 Z:0} index.js line 556 > eval:35:29
vrHelper.webVRCamera.devicePosition: {X: 0 Y:0 Z:0} index.js line 556 > eval:36:29

After entering VR:

positions: index.js line 556 > eval:33:29
scene.activeCamera.position: {X: 0 Y:1.7 Z:0} index.js line 556 > eval:34:29
vrHelper.position: {X: 0 Y:1.7 Z:0} index.js line 556 > eval:35:29
vrHelper.webVRCamera.devicePosition: {X: -0.3245651706523702 Y:2.392889678478241 Z:0.011026968880273103} index.js line 556 > eval:36:29

Teleporting:

teleporting to {X: 2.743488412919753 Y:0.9894249032020568 Z:-0.19536985715940913} index.js line 556 > eval:23:33
vrHelper.webVRCamera.deviceDistanceToRoomGround: 1.6945129036903381 index.js line 556 > eval:24:33
vrHelper.webVROptions.defaultHeight: 1.7 index.js line 556 > eval:25:33
vrHelper.webVRCamera.leftCamera.globalPosition: {X: -0.30112701654434204 Y:2.379987955093384 Z:0.0428072065114975} index.js line 556 > eval:26:33
vrHelper._webVRCamera.deviceScaleFactor:1 index.js line 556 > eval:27:33

Positions after teleporting:

positions: index.js line 556 > eval:33:29
scene.activeCamera.position: {X: 2.743488412919753 Y:0.9894249032020568 Z:-0.19536985715940913} index.js line 556 > eval:34:29
vrHelper.position: {X: 0 Y:1.7 Z:0} index.js line 556 > eval:35:29
vrHelper.webVRCamera.devicePosition: {X: 2.464460719956989 Y:1.672700822353363 Z:-0.18621963807834874} index.js line 556 > eval:36:29

Pinging @trevordev

Hey @tortru,

I think the issue is that the standing matrix for the vive pro may require an async operation to get the standing matrix. When the helper was originally created there was no such thing as a standing matrix so initialization of the helper is not async. You can try to workaround the problem by trying the following playground https://www.babylonjs-playground.com/#10D6YT#187 . And calling teleport to in the useStandingMatrix callback. Once webXR is supported by browsers this workflow will be corrected but let me know if you think any changes should be made now in helper to help you.

I finally found a workaround.
When first entering VR I am going to teleport to the current vrHelper position minus 1.7 z-axis.
But it is not working when I teleport immediately so I am going to wait 1 second.

I updated the playground accordingly.
https://www.babylonjs-playground.com/indexStable.html#NKLPD7#15

1 Like