Skip to main content

Function: velocityBetween()

function velocityBetween(
prev: PoseTuple,
next: PoseTuple,
dtSeconds: number
): {
angular: Vec3Tuple;
linear: Vec3Tuple;
};

Defined in: velocity.ts:17

Grip velocity derived from two consecutive poses - the throw/flick input every physics-flavoured grab needs, for the many providers that report poses but no velocity. Pure and dependency-free: the caller keeps the previous pose, this turns the pair into a velocity.

linear is metres per second in world space. angular is a rotation axis scaled by radians per second, taken along the shortest arc between the two orientations. Both are zero when dtSeconds is zero, negative or not a finite number, so a dropped frame can never produce Infinity.

The result is shaped to drop straight into InputSourceSnapshot.linearVelocity / .angularVelocity.

Parameters

ParameterType
prevPoseTuple
nextPoseTuple
dtSecondsnumber

Returns

{
angular: Vec3Tuple;
linear: Vec3Tuple;
}
NameTypeDefined in
angularVec3Tuplevelocity.ts:21
linearVec3Tuplevelocity.ts:21