Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-08-14 14:17:05 +0300
committerJulian Eisel <julian@blender.org>2020-08-14 14:27:09 +0300
commitab3a65151568d4f0cb0ac5747dd074cd8697c1d8 (patch)
treeb87df4612b592eaae9052ac380dccf7d72279553 /source/blender/windowmanager
parent4c625df75988b15a87614a567f49e2fd9ff3a3b0 (diff)
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.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_session.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index 9c6b8e8fbda..4edfd53c37a 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -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: