Java tutorial
import java.awt.Point; public class Util { /** * @param obj1X * @param obj1Y * @param obj2X * @param obj2Y * @return float */ public final static float calculateAngleFrom(float obj1X, float obj1Y, float obj2X, float obj2Y) { float angleTarget = (float) Math.toDegrees(Math.atan2(obj2Y - obj1Y, obj2X - obj1X)); if (angleTarget < 0) angleTarget = 360 + angleTarget; return angleTarget; } }