API

Function ComputeYawPitchFromLookAtToRef

  • Given a lookAt direction and center, compute the yaw and pitch angles that would produce that lookAt. This is the inverse of ComputeLookAtFromYawPitchToRef.

    Parameters

    • lookAt: Vector3

      The normalized lookAt direction vector

    • center: Vector3

      The center point on the globe

    • useRightHandedSystem: boolean

      Whether the scene uses a right-handed coordinate system

    • currentYaw: number

      The current yaw value to use as fallback when pitch is near 0 (looking straight down/up)

    • result: Vector2

      The Vector2 to store the result in (x = yaw, y = pitch)

    • OptionalcalculateUpVectorFromPointToRef: (point: Vector3, result: Vector3) => Vector3

      Optional function to calculate the up vector from a point. If supplied, this function will be used instead of assuming a spherical geocentric normal, allowing support for non-spherical planets or custom up vector logic.

    Returns Vector2

    The result Vector2