Math 如何找到随位置旋转的距离?

Math 如何找到随位置旋转的距离?,math,rotation,Math,Rotation,假设我的球员在1号位置,敌人在2号位置。假设玩家从零度开始,我需要对两点的位置做什么来获得玩家观察敌人所需的旋转 x1 = player's X coordinate y1 = player's Y coordinate x2 = enemy's X coordinate y2 = enemy's Y coordinate angle = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi() 从那里,您可以获得需要旋转的角度:)

假设我的球员在1号位置,敌人在2号位置。假设玩家从零度开始,我需要对两点的位置做什么来获得玩家观察敌人所需的旋转

x1 = player's X coordinate
y1 = player's Y coordinate

x2 = enemy's X coordinate
y2 = enemy's Y coordinate

angle = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi()
从那里,您可以获得需要旋转的角度:)