The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/steamvr_lh: account for IMU tangential velocity

Signed-off-by: MatrixFurry <did:plc:zmjoeu3stwcn44647rhxa44o>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2625>

+10 -3
+10 -3
src/xrt/drivers/steamvr_lh/device.cpp
··· 806 806 relation.linear_velocity = copy_vec3(newPose.vecVelocity); 807 807 relation.angular_velocity = copy_vec3(newPose.vecAngularVelocity); 808 808 809 - math_quat_rotate_vec3(&relation.pose.orientation, &relation.angular_velocity, &relation.angular_velocity); 809 + // local transform (head to driver offset) 810 + const xrt_pose local = copy_pose(newPose.qDriverFromHeadRotation, newPose.vecDriverFromHeadTranslation); 811 + 812 + // IMU linear velocity contribution due to rotation around driver origin (tangential velocity) 813 + xrt_vec3 tangential_velocity; 814 + math_vec3_cross(&relation.angular_velocity, &local.position, &tangential_velocity); 815 + math_quat_rotate_vec3(&relation.pose.orientation, &tangential_velocity, &tangential_velocity); 816 + math_vec3_accum(&tangential_velocity, &relation.linear_velocity); 810 817 811 - // apply over local transform 812 - const xrt_pose local = copy_pose(newPose.qDriverFromHeadRotation, newPose.vecDriverFromHeadTranslation); 818 + // apply local transform 819 + math_quat_rotate_vec3(&relation.pose.orientation, &relation.angular_velocity, &relation.angular_velocity); 813 820 math_pose_transform(&relation.pose, &local, &relation.pose); 814 821 815 822 // apply world transform