Skip to content

Rigidbody Set Velocity If Input Axis Not Zero

Sets Rigidbody velocity only on axes where the input exceeds a threshold.

Parameters

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

Notes

  • This lets you change one or two velocity axes while keeping the others unchanged.
  • It is helpful for character movement where only active input axes should override velocity.