method
Math.atan2
Math.atan2(y, x) -> fixed
Returns the angle in radians from the positive x-axis to the point (x, y), in the full range -pi..pi — the standard way to get a heading from a direction vector. Note the argument order is y then x. Deterministic fixed-point, accurate to within about a degree.
Example
program Demo {
handler Step phase Update {
let heading = Math.atan2(target_y - y, target_x - x)
}
}