To add to this. Modern games tend to use linear interpolation to avoid this issue. Basically you find the magnitude of the direction vector with
[I]sqrt[/I](x²+y²)
Then you normalize the vector by dividing x and y by the magnitude calculated above. This gives you a new vector that you would use in your movement code.
For example, if your direction is (1,1) then you'd do.
sqrt(1²+1²)=1.414 1/1.41=0.707
So your new direction vector becomes (0.707,0.707).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.