From 798932fbf2458bc9fa5029d9bdf0fd13e050df8c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 14 Mar 2022 16:11:18 +0000 Subject: [PATCH] st/oxr: Set position to identity and zero velocities if the spaces are locatable --- src/xrt/state_trackers/oxr/oxr_space.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/xrt/state_trackers/oxr/oxr_space.c b/src/xrt/state_trackers/oxr/oxr_space.c index e51bd3e9e..97050918e 100644 --- a/src/xrt/state_trackers/oxr/oxr_space.c +++ b/src/xrt/state_trackers/oxr/oxr_space.c @@ -429,6 +429,21 @@ oxr_space_locate( bool has_pure_relation = get_pure_space_relation(log, spc, baseSpc, time, &pure); if (!has_pure_relation) { location->locationFlags = 0; + + // Copy + union { + struct xrt_pose xrt; + XrPosef oxr; + } safe_copy = {XRT_POSE_IDENTITY}; + location->pose = safe_copy.oxr; + + XrSpaceVelocity *vel = (XrSpaceVelocity *)location->next; + if (vel) { + vel->velocityFlags = 0; + U_ZERO(&vel->linearVelocity); + U_ZERO(&vel->angularVelocity); + } + return XR_SUCCESS; }