MrClear
MrClear

Reputation: 139

Shifting Angles using Arctan2

I am currently building a pathing system for a game. I've recently figured out the whole Arctan2(Y,X) function to help with rotating the player to the next way-point. However after a lot of debugging I found out that the angle system used in-game isn't the same as a normal angle plan.

enter image description here

So the issue is the Arctan2(Y,X) function returns an angle that is approtate to the "normal" plan see on the right in the link above, But I need to convert that angle into a usable angle for the In-game angle plan... I hope I am explaining this somewhat decently.

Any advice would be greatly appreciated!

Upvotes: 0

Views: 227

Answers (1)

Andreas Rejbrand
Andreas Rejbrand

Reputation: 109003

By looking at your picture, it is clear that the mapping f that maps the angle in the left system to a "normal" angle (mod 360) is given by

f: α ↦ 270 − α.

Hence, the inverse mapping, f⁻¹, is given by

f⁻¹: α ↦ 270 − α.

(Clearly, f is an involution.)

Upvotes: 2

Related Questions