server: New heading/rotation code using atan.