我将如何测试鼠标光标位置是否(相对)与玩家作为实体的角度相同?

How would I test if the mouse cursor location is at (relatively) the same angle from the player as an entity?

这可能只是一些简单的三角函数,自从我参加 class 后我就忘记了。我想弄清楚鼠标光标是否与玩家的实体方向相同。基本上,我只是想比较玩家到光标的角度和玩家到实体的角度是否相同,+/- 几度用于轻微的自动瞄准。

我只花了将近一个小时尝试仅使用 sine/tan 和直角几何来解决这个问题 - 这是一个比看起来更复杂的问题。

您似乎想使用 atan2 函数。

See this Math.SE thread.

Java 有一个 Math.atan2 函数。 Documentation