diff options
author | Julian Eisel <julian@blender.org> | 2020-03-25 18:06:13 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-03-25 18:09:39 +0300 |
commit | e5f7b31dd427fa72ae6b7e3e085c6b92621084a7 (patch) | |
tree | d9e55ac2b6f3220c0e07d848562bad10e7ab4685 /source | |
parent | 04ab677761649312354c4257753520f5df575e81 (diff) |
Fix VR viewer offset on session start with no positional tracking
The current viewer pose position as determined by the OpenXR runtime
would be applied as offset. This offset should however only be set when
toggling the positional tracking while the session already runs.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_xr.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_xr.c b/source/blender/windowmanager/intern/wm_xr.c index 95c0f353298..7422fc97f04 100644 --- a/source/blender/windowmanager/intern/wm_xr.c +++ b/source/blender/windowmanager/intern/wm_xr.c @@ -300,7 +300,13 @@ static void wm_xr_draw_data_populate(const wmXrSessionState *state, wm_xr_base_pose_calc(scene, settings, &r_draw_data->base_pose); - if (position_tracking_toggled || !state->is_view_data_set) { + /* Set the eye position offset, it's used to offset the base pose when changing positional + * tracking. */ + if (!state->is_view_data_set) { + /* Always use the exact base pose with no offset when starting the session. */ + copy_v3_fl(r_draw_data->eye_position_ofs, 0.0f); + } + else if (position_tracking_toggled) { if (use_position_tracking) { copy_v3_fl(r_draw_data->eye_position_ofs, 0.0f); } |