Guides
Guides

VRTK_VelocityEstimator

Overview

The Velocity Estimator is used to calculate an estimated velocity on a moving object that is moving outside of Unity physics.

Objects that have rigidbodies and use Unity physics to move around will automatically provide accurate velocity and angular velocity information.

Any object that is moved around using absolute positions or moving the transform position will not be able to provide accurate velocity or angular velocity information.
When the Velocity Estimator script is applied to any GameObject it will provide a best case estimation of what the object's velocity and angular velocity is based on a given number of position and rotation samples.
The more samples used, the higher the precision but the script will be more demanding on processing time.

Inspector Parameters

  • Auto Start Sampling: Begin the sampling routine when the script is enabled.
  • Velocity Average Frames: The number of frames to average when calculating velocity.
  • Angular Velocity Average Frames: The number of frames to average when calculating angular velocity.

Class Methods

StartEstimation/0

public virtual void StartEstimation()

  • Parameters
    • none
  • Returns
    • none

The StartEstimation method begins logging samples of position and rotation for the GameObject.

EndEstimation/0

public virtual void EndEstimation()

  • Parameters
    • none
  • Returns
    • none

The EndEstimation method stops logging samples of position and rotation for the GameObject.

GetVelocityEstimate/0

public virtual Vector3 GetVelocityEstimate()

  • Parameters
    • none
  • Returns
    • Vector3 - The velocity estimate vector of the GameObject

The GetVelocityEstimate method returns the current velocity estimate.

GetAngularVelocityEstimate/0

public virtual Vector3 GetAngularVelocityEstimate()

  • Parameters
    • none
  • Returns
    • Vector3 - The angular velocity estimate vector of the GameObject

The GetAngularVelocityEstimate method returns the current angular velocity estimate.

GetAccelerationEstimate/0

public virtual Vector3 GetAccelerationEstimate()

  • Parameters
    • none
  • Returns
    • Vector3 - The acceleration estimate vector of the GameObject

The GetAccelerationEstimate method returns the current acceleration estimate.