/// <summary>Returns the angle we are facing towards given our point to the targets point (taking a stab at this description)</summary> /// <param name="me">the player</param> /// <param name="target">the target</param> /// <returns>The facing towards unit radians.</returns> private static float FacingTowardsUnitRadians(WoWPoint me, WoWPoint target) { try { WoWPoint direction = me.GetDirectionTo(target); direction.Normalize(); float myFacing = StyxWoW.Me.Rotation; // real and safe tan reverse function double ret = Math.Atan2(direction.Y, direction.X); double alpha = Math.Abs(myFacing - ret); if (alpha > Math.PI) { alpha = Math.Abs(2 * Math.PI - alpha); } if (Double.IsNaN(alpha)) return 0f; return (float)alpha; } catch { return 0f; } }