Vector Length issue

So I got “Get velocity”->“Vector Length XY” to detect the movement speed of my character.

image

Then Im trying to debug and see the result, does my character speed shows right. And it works absolutely fine:

So the part when the problem starts. Im trying to make a condition:
if “VectorLength XY” return value → Equal to == 270 (walking character speed) → I get a string message “It works”

And I get this as a result:

This doesn’t make any logic for me at all. Was trying to figure out what’s the problem by myself but unsuccessful

How do I make all these work?

just print the actual value to test, it may be stuck on something like 269.999.

you could use a nearly equal or >= if so

This is what Im doing in the 1st video, this is not the problem. It gets true regarding world but not the character. if you look closely at how I move the mouse in the second video, everything becomes clear

So if I start the game and then → just move forward → it works fine
but when i move my mouse a little bit → it doesn’t. So the result is not the vector length, but velocity. I tried to explain as best I could

yeah i mean remove the branch for testing, once we know what value youre getting if any we can debug it further


do you mean like this? i dont get it :smile:

no plug it straight into the vector length, or event the velocity


do you mean this?

yep, so it does print 270. i feel like it might be a rounding error, try using nearly equal instead of equal on your branch

1 Like

yeah that works fine now, thanks. But are there any ways to round up the return value so it’ll be easy to use with variables?

yep literally round it and save it as an int

1 Like

thanks a lot :partying_face:

use this node to compare floats:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.