How to use atan2() in combination with other Radian angle systems

后端 未结 4 730
陌清茗
陌清茗 2021-02-04 18:46

I am struggling with this in JavaScript, but this problem applies to many other languages/environments as well.

I want to have one object rotating towards the position o

4条回答
  •  生来不讨喜
    2021-02-04 19:18

    If you want the angle to increase clockwise from 0 on the y axis, calculate the angle as atan2(x,y). This however give negative angles for x<0, so you should add 2*pi in this case.

提交回复
热议问题