Repository: FlaxEngine/FlaxEngine
File: Source/Engine/Core/Math/Quaternion.cs (C#)

Code before:
        /// <param name="result">When the method completes, contains the created look-at quaternion.</param>
        public static void RotationLookAt(ref Vector3 forward, ref Vector3 up, out Quaternion result)
        {
            Vector3 eye = Vector3.Zero;
            LookAt(ref eye, ref forward, ref up, out result);
        }

        /// <summary>
        /// Creates a left-handed, look-at quaternion.
        /// </summary>
        /// <param name="forward">The camera's forward direction.</param>
        /// <param name="up">The camera's up vector.</param>
        /// <returns>The created look-at quaternion.</returns>
        public static Quaternion RotationLookAt(Vector3 forward, Vector3 up = Vector3.Up)
        {
            RotationLookAt(ref forward, ref up, out var result);
            return result;
        }

        /// <summary>
        /// Creates a rotation with the specified forward and upwards directions.
        /// </summary>
        /// <param name="forward">The forward direction. Direction to orient towards.</param>
        /// <param name="up">Up direction. Constrains y axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel.</param>
        /// <returns>The calculated quaternion.</returns>
        public static Quaternion LookRotation(Vector3 forward, Vector3 up = Vector3.Up)
        {
            LookRotation(ref forward, ref up, out var result);
            return result;
        }

        /// <summary>
        /// Creates a rotation with the specified forward and upwards directions.
        /// </summary>
        /// <param name="forward">The forward direction. Direction to orient towards.</param>
        /// <param name="up">The up direction. Constrains y axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel.</param>
        /// <param name="result">The calculated quaternion.</param>
        public static void LookRotation(ref Vector3 forward, ref Vector3 up, out Quaternion result)
        {
            Vector3 forwardNorm = forward;
            forwardNorm.Normalize();
            Vector3.Cross(ref up, ref forwardNorm, out var rightNorm);
            rightNorm.Normalize();
            Vector3.Cross(ref forwardNorm, ref rightNorm, out var upNorm);

            float m00 = rightNorm.X;
            float m01 = rightNorm.Y;
            float m02 = rightNorm.Z;
            float m10 = upNorm.X;
            float m11 = upNorm.Y;
            float m12 = upNorm.Z;

Review comment (suggestion):
The default value must be a compile time constant, that's why it's not possible to set a custom value, C# limitation.
There is a workaround using nullable value but it's not very clean imo.

Code after:
        {
            LookAt(ref eye, ref target, ref up, out var result);
            return result;
        }

        /// <summary>
        /// Creates a left-handed, look-at quaternion.
        /// </summary>
        /// <param name="forward">The camera's forward direction.</param>
        /// <param name="up">The camera's up vector.</param>
        /// <param name="result">When the method completes, contains the created look-at quaternion.</param>
        public static void RotationLookAt(ref Vector3 forward, ref Vector3 up, out Quaternion result)
        {
            Vector3 eye = Vector3.Zero;
            LookAt(ref eye, ref forward, ref up, out result);
        }

        /// <summary>
        /// Creates a left-handed, look-at quaternion.
        /// </summary>
        /// <param name="forward">The camera's forward direction.</param>
        /// <returns>The created look-at quaternion.</returns>
        public static Quaternion RotationLookAt(Vector3 forward)
        {
            return RotationLookAt(forward, Vector3.Up);
        }
        
        /// <summary>
        /// Creates a left-handed, look-at quaternion.
        /// </summary>
        /// <param name="forward">The camera's forward direction.</param>
        /// <param name="up">The camera's up vector.</param>
        /// <returns>The created look-at quaternion.</returns>
        public static Quaternion RotationLookAt(Vector3 forward, Vector3 up)
        {
            RotationLookAt(ref forward, ref up, out var result);
            return result;
        }

        /// <summary>
        /// Creates a rotation with the specified forward and upwards directions.
        /// </summary>
        /// <param name="forward">The forward direction. Direction to orient towards.</param>
        /// <returns>The calculated quaternion.</returns>
        public static Quaternion LookRotation(Vector3 forward)
        {
            return LookRotation(forward, Vector3.Up);
        }

        /// <summary>
        /// Creates a rotation with the specified forward and upwards directions.