🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Unity - How do i clamp the speed of my character controller

Started by
3 comments, last by Alberth 4 years, 2 months ago

Hi everyone, im having a problem with my character controller speed

When i press both axis the speed increment, i dont understand why. Do you know a way for clamping my vector3 move?…

Advertisement

You should probably find out why, and fix the problem rather than work around the problem.

Did you try debugging? When you dump those values to the screen do they make sense?

I assume you already considered that both x and z have value ‘walkspeed’ when used, so in total, you're moving sqrt(2)*walkspeed. (Instead of 3d think 2d, moving 1 in either x or y has length 1. moving both has length sqrt(2).)

if they are both pressed divide move by 2. Probably the easiest solution.

In 3D, 1+1 vector doesn't necessarily make it a 2 vector. That only works correctly if both vectors are fully aligned. Ie (1, 0, 0) + (-1, 0, 0) is much shorter than length 2.

This topic is closed to new replies.

Advertisement