Checking if Character is moving

So im trying to get if the character is moving or standing still.

And i tried Get velocity and vector lenght and set it to an = with 0

So in theory When velocity is 0 It should set Standing true
but no matter if i move or no it always sets it true
any help?

Are you setting it with =
or comparing it with ==. ?

Im using <=

make sure youre comparing the vector length, since that will tell you the total positive speed of all its axes combined, wheter in a positive or negative direction.

Make sure you are getting the velocity from the character movement.

Do it like this:

If your character has velocity higher than 0 it will set to True, otherwise it will return False, which means that character is standing still.

11 Likes

This definetly helped me a lot. I was looking for a way to not make my stamina beeing drained once I am with my sprint key pressed and not moving.

A better way to do it is with Input actions. That way you do not have logic on the tick event. I map an inputAxis to the W key and I map W to the “ForwardKey” input action. Just have to remember if you or the player remaps keys you have to change it on both.

In that case you will want to check more things, like whether the character is currently falling (airborne) and if they have any inputs higher than 0 (are trying to move themselves instead of being moved by outside forces)