cameraAnglesOf function

(double, double) cameraAnglesOf(
  1. Vector3 direction
)

The pitch and yaw that look along direction.

Implementation

(double pitch, double yaw) cameraAnglesOf(Vector3 direction) {
  final flat = math.sqrt(direction.x * direction.x + direction.z * direction.z);
  return (-math.atan2(direction.y, flat), math.atan2(direction.x, direction.z));
}