Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Adjust angle towards another angle

$
0
0
So I have two angles, a1 and a2, in the range [0, 2*PI). I want to adjust a1 .01 radians towards a2. How do I determine if I need to add or subtract .01 radians? I understand that I can calculate the two differences thusly: difference1 = Math.abs(a2 - a1) difference2 = 2*PI - difference1 But even given those two differences, I don't see how to make the leap in the right direction. I can't think of a simple way of doing it that doesn't involve looking at things on a case by case, per quadrant basis.

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>