Scaling input axis on a grid

My character controller moves in the 8 cardinal directions for easier platforming. My current setup has an unintended side effect of preventing fine movement. The player will either be fully running, or stopped.

I would like for the player to be able to throttle the character in any of the cardinal directions. I can achieve the throttling if I remove the last Snap to Grid, but this also allows the player to move in any direction, which I don’t want.

Hey there,

not sure being aware of your movement setup but “Snap to grid” is ok which gives you the cardinal direction you want. If you multiply with original vector’s min value you should be able to get a scaling movement.
So when you do


here you loose original magnitude
when you plug into

Instead you need to plug in the original magnitude which is AxisForward / AxisRight as I see from your scripts.

That’s what I thought too, but the problem with that method is that both axes can scale the input individually, which basically nullifies the Snap to Grid and results in the player being able to move in any direction.

So I guess I need some way to make sure that only one axis is scaling at a time, unless moving diagonally, in which case both must scale at the same rate.

After some trial and error I came up with this solution, which is stupidly complex but seems to work:

I understand.

Another method for cardinal movement is simply you can make angular detection.

I recently used in a demo for radial menu, which quantinize the movement in 360 8 cardinal directions . You can use same if you wish and keep scale input at one since we scale the input vector accordingly. I just put into 3rd person template and works nicely.

I put explanations on top if you need. It’s more simple but if it works it works.

1 Like