diff options
-rw-r--r-- | source/blender/windowmanager/xr/intern/wm_xr_intern.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/xr/intern/wm_xr_session.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.h b/source/blender/windowmanager/xr/intern/wm_xr_intern.h index 9b7b81f769a..c49e9e534b6 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_intern.h +++ b/source/blender/windowmanager/xr/intern/wm_xr_intern.h @@ -70,6 +70,8 @@ typedef struct wmXrDrawData { * space). With positional tracking enabled, it should be the same as the base pose, when * disabled it also contains a location delta from the moment the option was toggled. */ GHOST_XrPose base_pose; + /** Offset to _substract_ from the OpenXR eye and viewer pose to get the wanted effective pose + * (e.g. a pose exactly at the landmark position). */ float eye_position_ofs[3]; /* Local/view space. */ } wmXrDrawData; diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c index ab419bac6ac..4b991f69355 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_session.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c @@ -208,8 +208,9 @@ void wm_xr_session_draw_data_update(const wmXrSessionState *state, switch (event) { case SESSION_STATE_EVENT_START: - /* Always use the exact base pose with no offset when starting the session. */ - copy_v3_fl(draw_data->eye_position_ofs, 0.0f); + /* We want to start the session exactly at landmark position. Runtimes may have a non-[0,0,0] + * starting position that we have to substract for that. */ + copy_v3_v3(draw_data->eye_position_ofs, draw_view->local_pose.position); break; /* This should be triggered by the VR add-on if a landmark changes. */ case SESSION_STATE_EVENT_RESET_TO_BASE_POSE: |