The open source OpenXR runtime
0
fork

Configure Feed

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

st/oxr: Ensure velocities flags and values are zeroed

authored by

Jakob Bornecrantz and committed by
Jakob Bornecrantz
4fc02cf6 798932fb

+17 -9
+17 -9
src/xrt/state_trackers/oxr/oxr_space.c
··· 468 468 469 469 XrSpaceVelocity *vel = (XrSpaceVelocity *)location->next; 470 470 if (vel) { 471 - vel->linearVelocity.x = result.linear_velocity.x; 472 - vel->linearVelocity.y = result.linear_velocity.y; 473 - vel->linearVelocity.z = result.linear_velocity.z; 474 - 475 - vel->angularVelocity.x = result.angular_velocity.x; 476 - vel->angularVelocity.y = result.angular_velocity.y; 477 - vel->angularVelocity.z = result.angular_velocity.z; 471 + vel->velocityFlags = 0; 472 + if ((result.relation_flags & XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT) != 0) { 473 + vel->linearVelocity.x = result.linear_velocity.x; 474 + vel->linearVelocity.y = result.linear_velocity.y; 475 + vel->linearVelocity.z = result.linear_velocity.z; 476 + vel->velocityFlags |= XR_SPACE_VELOCITY_LINEAR_VALID_BIT; 477 + } else { 478 + U_ZERO(&vel->linearVelocity); 479 + } 478 480 479 - vel->velocityFlags |= (location->locationFlags & XR_SPACE_VELOCITY_LINEAR_VALID_BIT); 480 - vel->velocityFlags |= (location->locationFlags & XR_SPACE_VELOCITY_ANGULAR_VALID_BIT); 481 + if ((result.relation_flags & XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT) != 0) { 482 + vel->angularVelocity.x = result.angular_velocity.x; 483 + vel->angularVelocity.y = result.angular_velocity.y; 484 + vel->angularVelocity.z = result.angular_velocity.z; 485 + vel->velocityFlags |= XR_SPACE_VELOCITY_ANGULAR_VALID_BIT; 486 + } else { 487 + U_ZERO(&vel->angularVelocity); 488 + } 481 489 } 482 490 483 491 #if 0