WebXR Input Source: linear velocity
Linear Velocity has been added for handheld devices in WebXR specs: https://pr-preview.s3.amazonaws.com/cabanier/webxr/pull/1182.html#dom-xrpose-linearvelocity
This also been implemented in the latest Oculus Browser: https://twitter.com/rcabanier/status/1377459759876505606
This PR implements input source linear velocity and also emulates it with the same logic if it is not available/supported. So if the input source has a grip space - we guarantee to provide linear velocity.
New APIs:
// pc.XrInputSource
inputSource.getLinearVelocity() // Vec3 with world space linear velocity in units per second, or null if input source is not handheld
I confirm I have signed the Contributor License Agreement.
How about returning a zero vector if it is not available? This would match the behavior we get when trying to read the velocity of a kinematic or static rigidbody in physics.
How about returning a zero vector if it is not available? This would match the behavior we get when trying to read the velocity of a kinematic or static rigidbody in physics.
There are input sources that have no such concept as position, for example: touch in AR session, or voice commands input source, or gaze style input source. So we should not provide linear velocity for such types, just like we don't provide position and rotation data for such input sources. So it stays consistent for XR input source concepts.
Would love to get a second look at this PR, so it can be merged/resolved.