Showing results for 
Search instead for 
Did you mean: 

HMD Camera position uses wrong frame's WorldToMeters when that value is changed during runtime.

Level 2
So, in our game, we sometimes need to scale roughly 4k meshes at once, which results in crappy performance, so we instead went the other way and scale the player, world and everything other than those meshes to achieve the same visual result.

When WorldToMeters is gradually decreased, we simulteanously scale down the player's controllers and any objects that are supposed to appear static to the player.
To the player it seems they and the floor stay the same size and the non-moving meshes appear larger.

Under SteamVR this works perfectly and there is no noticeable movement or wobble.
Under OculusVR, when decreasing the WorldToMeters, the camera (only the camera, controllers appear stable) is pulled slightly towards the center of tracking. This effect gets larger with distance of the headset from the center of tracking.
Same effect but in the opposite direction is noticeable when scaling the world down.

I'm assuming that as WorldToMeters is being gradually changed, Oculus VR seems to multiply camera offset from tracking center by the previous frame's WorldToMeters, which results in the camera wobbling around, I tried debugging this in OculusHMD.cpp, but couldn't pin it down, as I lack deeper understanding of the pose acquisition and projection matrix handling.

I'm attaching a minimal project that is setup for SteamVR (Vive + WMR) and OculusVR both, you can see the effect by holding both grips and scaling the world quickly.

The floor in the map has a "moving_actor" tag, which the pawn then moves and scales so it appears static.
The box has a "pivot_actor" tag, which means the pawn will use it as a pivot for the world scaling/rotation.

Occurs on Epic's own 4.25, 4.26 preview, and Oculus latest release (4.25.3) UE versions.

I just noticed that on Vive, the camera doesn't wobble, but the controllers slightly do, which makes me even more confused and uncertain if this is actually a bug in our code or in OculusVR. Is there any sample project which would use this inverse-world-scaling or any hints as what to do to prevent this?