Probably, but this answer is misleading because you can not compare vectors with “greater than”, like Kurt said. He probably want to do something like
_playerRB.linearVelocity.magnitude > 0f
or usually better to use something like _playerRB.linearVelocity.magnitude > 0.1f
or even better (slightly more performant) _playerRB.linearVelocity.sqrMagnitude > 0.01f
General advice NOT to cram multiple unrelated conditions into a single if statement. This will be hard to debug and reason about.
When using Input, I consider it best practice to react to input first and foremost, and perform any additional checks after the fact. So Input conditions should all be at the same level. And refactor any non-obvious checks to methods that “speak out loud” what they actually check.
I would translate it to this:
if (Input.GetKey(KeyCode.W) == false)
{
if (_grounded && IsMoving)
{
// do stuff
}
}
bool IsMoving => _playerRB.linearVelocity > _threshold;
Much easier to read because that’s what 99% of programming is all about.