Fix offset applied on top of VR landmark with no positional tracking

On VR session start with positional tracking disabled, the pose would
have an offset applied but it was supposed to start exactly at the
landmark position.

Issue is that we applied the offset to cancel out the position offset
reported by the OpenXR runtime incorrectly. We only want to do that if
positional tracking is enabled, because if not we don't even apply the
runtime's position offset. So we'd cancel something out that wasn't
there.
This commit is contained in:
Julian Eisel 2020-08-14 13:17:05 +02:00
parent 4c625df759
commit ab3a651515
1 changed files with 8 additions and 3 deletions

View File

@ -251,9 +251,14 @@ void wm_xr_session_draw_data_update(const wmXrSessionState *state,
switch (event) {
case SESSION_STATE_EVENT_START:
/* 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);
if (use_position_tracking) {
/* We want to start the session exactly at landmark position.
* Run-times may have a non-[0,0,0] starting position that we have to subtract for that. */
copy_v3_v3(draw_data->eye_position_ofs, draw_view->local_pose.position);
}
else {
copy_v3_fl(draw_data->eye_position_ofs, 0.0f);
}
break;
/* This should be triggered by the VR add-on if a landmark changes. */
case SESSION_STATE_EVENT_RESET_TO_BASE_POSE: