• News

• Industries

• Learning & Support

• Community

• Marketplace

# Character Moves Faster Diagonally... How to fix please?

I have noticed that it moves faster diagonally… How to stop this?

Clamp was not originally there, but I have been placing it in various places because supposedly it is a way to fix, but I have not been able to get it to fix…

Really appreciate any assistance.

The axis supplies a 0-1 range, so clamping them to 0-1 will do nothing at the moment. What you need is for both of them to be in communication with each other, so that if move forward is at 0.8, move right gets clamped to 0.2. that should limit overall movement to 1. not at my pc right now so I can’t test, but if you take the move forward axis, invert it, and plug it into the max of the move right, as the number gets larger on that axis, the clamp will get lower, slowing movement. repeat for move right axis to move forward clamp max. You will need some more math in there so that the player can still transition to diagonal from full run though, Sort of like a priority to move right that always slows move forward. (or it might work out of the box)
Edit: for the inversion, the “map range clamped” node will do it, axis value goes to the main pin, then in the input fields type 0 and 1 and on the output fields type 1 and 0. now 1 will = 0 and vice versa.

Subtract the axis value from 1.
then whatever is left is the max clamp value of the other axis.

You should be able to check both and set the max on both and have it working with that very basic math.
at .5 on A, you can only reach .5 on B. And vice-versa.

Well, ok. Not that simple because the axis is also -1 to 1. Not just positive.
So there’s definitely more that would need to happen, but that’s probably a good way to start at it.

Depending on the setup: since you’re using a Pawn, you can also add a Floating Movement Component and have it clamp Max Speed:

No matter how much Movement Input is accumulated this frame, the pawn will not exceed this value.

edit: just noticed you mentioned a *character *- which gives you even more control, actually. Unless you’re not using components for movement, that is.

Sorry, but is it possible to get an example? This is hurting my head trying to figure out and calculate… Cannot seem to get it working no matter how I do it.

just add a divide to the scale value float right before the scale value input. divide by 2.

Why do you multiply the scale ? Did you verify if all are constant ? Take a look at the original ThirdPerson blueprint take the simple code there is. normaly it’s not faster to run on X and Y. It depend on a direction vector and a speed. So it’s same speed on every directions.
Scale is a sort of speed 0-1 , same on every directions, no ? Or… are you on a grid system ?