My clamping doesn't work?

I was trying to get my speed into 1 value to set the global time dilation(this is a debug version so it doesn’t have that) and i need it to be at least 1 but for some reason it is going negative


image
this part isn’t working:
image
how do i fix it?

Hey there @Gsc159753! Welcome to the community! It looks like you’re forgetting to run the set function here:
image

If it’s not ran, it won’t set the speed to it’s input at all.

If you clamp the velocity to be always positive it will only work when the character is moving forward/right, when it goes back/left the value goes negative.

To get a positive only velocity value you can get the ‘VECTOR LENGHT’, but this way will also get the Z velocity.

If you dont want Z you can get your X/Y and ‘MAKE VECTOR 2D’, then get the vector 2d lenght.

And if you want only one axis value, only X for example, you can get X and make it an ‘ABSOLUTE’ float.

1 Like

You have to give the input in execution pin
Of set speed node (connected to the clamp )