Fix broken behavior on active VR Landmark change

There would always be an unintended offset applied. Per design there
should not be any offset when changing VR Landmarks, the view should
just jump exactly to the Landmark.

Due to the recent changes, we don't have to add, but substract the eye
offset we apply to get the wanted behavior.

Mistake in 607d745a79.
This commit is contained in:
Julian Eisel 2020-08-10 13:35:47 +02:00
parent 52a57af3d5
commit 727a744e3c
2 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ static void wm_xr_draw_matrices_create(const wmXrDrawData *draw_data,
copy_qt_qt(eye_pose.orientation_quat, draw_view->eye_pose.orientation_quat);
copy_v3_v3(eye_pose.position, draw_view->eye_pose.position);
add_v3_v3(eye_pose.position, draw_data->eye_position_ofs);
sub_v3_v3(eye_pose.position, draw_data->eye_position_ofs);
if ((session_settings->flag & XR_SESSION_USE_POSITION_TRACKING) == 0) {
sub_v3_v3(eye_pose.position, draw_view->local_pose.position);
}

View File

@ -255,9 +255,9 @@ void wm_xr_session_state_update(const XrSessionSettings *settings,
copy_v3_v3(viewer_pose.position, draw_data->base_pose.position);
/* The local pose and the eye pose (which is copied from an earlier local pose) both are view
* space, so Y-up. In this case we need them in regular Z-up. */
viewer_pose.position[0] += draw_data->eye_position_ofs[0];
viewer_pose.position[1] -= draw_data->eye_position_ofs[2];
viewer_pose.position[2] += draw_data->eye_position_ofs[1];
viewer_pose.position[0] -= draw_data->eye_position_ofs[0];
viewer_pose.position[1] += draw_data->eye_position_ofs[2];
viewer_pose.position[2] -= draw_data->eye_position_ofs[1];
if (use_position_tracking) {
viewer_pose.position[0] += draw_view->local_pose.position[0];
viewer_pose.position[1] -= draw_view->local_pose.position[2];