horizontalForward property

Vector3 get horizontalForward

The camera's look direction projected onto the horizontal XZ ground plane (unit length), for ground-relative movement and panning.

When the camera looks straight up or down along Y, falls back to the top-of-screen direction (right.cross(Vector3(0, 1, 0))).

Implementation

Vector3 get horizontalForward {
  final flat = Vector3(forward.x, 0.0, forward.z);
  if (flat.length2 > 1e-12) {
    return flat..normalize();
  }
  final fallback = right.cross(Vector3(0.0, 1.0, 0.0));
  return fallback.length2 > 1e-12
      ? (fallback..normalize())
      : Vector3(0.0, 0.0, 1.0);
}