Skip to content

Rigidbody Set Velocity If Input Not Zero

Sets Rigidbody velocity only when the input magnitude is above a threshold.

Parameters

Parameter Description
Rigidbody The Rigidbody to modify.
Input Velocity to apply.
Threshold Input magnitudes below this are treated as zero.
Space Whether the velocity is in World or Self space.

Notes

  • This is useful when you want to preserve current velocity when there is no input.
  • In local space, the input is converted through the Rigidbody transform.