@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / index / ThrowVelocityTracker
Class: ThrowVelocityTracker ​
Defined in: xr/throwVelocity.ts:52
Rolling buffer of hand positions used to recover throw velocity.
One per active grab; cleared on release.
Constructors ​
Constructor ​
new ThrowVelocityTracker(): ThrowVelocityTracker;Returns ​
ThrowVelocityTracker
Methods ​
record() ​
record(position, time): void;Defined in: xr/throwVelocity.ts:56
Record where the hand is now. Call once per frame while held.
Parameters ​
| Parameter | Type |
|---|---|
position | Vector3 |
time | number |
Returns ​
void
computeVelocity() ​
computeVelocity(now): Vector3;Defined in: xr/throwVelocity.ts:71
Velocity to release with, in metres/second.
Uses the FASTEST segment inside the window rather than the most recent or the window average. Users decelerate as they open their hand, so the last segment understates the throw and the average washes it out; peak speed is what matches the motion the user actually felt they made.
Parameters ​
| Parameter | Type |
|---|---|
now | number |
Returns ​
Vector3
clear() ​
clear(): void;Defined in: xr/throwVelocity.ts:105
Returns ​
void

