Angular and linear velocities history tracker.

This helper allows to accumulate and smooth the velocities over multiple frames.

Constructors

Methods

  • Computes the angular velocity based on the current history.

    Parameters

    • out: vec3

      The output angular velocity.

    Returns vec3

    vec3 The out parameter.

    Remarks

    This method isn't a simple getter and will perform computations, Only use once per frame or after the object is rotated.

  • Resets the history tracker.

    Parameters

    • target: Object3D

      The object that was tracked.

    Returns void

    Remarks

    This method needs a target because it resets the history based on the position of the target.

  • Update the history with the given object.

    Parameters

    • target: Object3D

      The target object to update from.

    • delta: number

      The delta time.

    Returns void

  • Update the history with the given XR pose.

    Parameters

    • xrPose: XRPose

      The XR pose.

    • space: Object3D
    • target: Object3D

      The object to get the velocity from, in case the XR pose doesn't expose any.

    • delta: number

      The delta time.

    Returns void

    Remarks

    Use this when available, because the velocities from the XR Pose are more accurate.

  • Computes the linear velocity based on the current history.

    Parameters

    • out: vec3 = ...

      The output velocity.

    Returns vec3

    The out parameter.

    Remarks

    This method isn't a simple getter and will perform computations, Only use this once per frame or after the object is moved.