diff --git a/Source/Engine/Core/Math/Vector3.h b/Source/Engine/Core/Math/Vector3.h
index 76b9aa2f8..590c3adb0 100644
--- a/Source/Engine/Core/Math/Vector3.h
+++ b/Source/Engine/Core/Math/Vector3.h
@@ -569,7 +569,7 @@ public:
///
/// Makes sure that Length of the output vector is always below max and above 0.
///
- /// Input Vector.
+ /// Input Vector.
/// Max Length
static Vector3Base ClampLength(const Vector3Base& v, float max)
{
@@ -579,7 +579,7 @@ public:
///
/// Makes sure that Length of the output vector is always below max and above min.
///
- /// Input Vector.
+ /// Input Vector.
/// Min Length
/// Max Length
static Vector3Base ClampLength(const Vector3Base& v, float min, float max)
@@ -592,26 +592,24 @@ public:
///
/// Makes sure that Length of the output vector is always below max and above min.
///
- /// Input Vector.
+ /// Input Vector.
/// Min Length
/// Max Length
/// The result vector.
static void ClampLength(const Vector3Base& v, float min, float max, Vector3Base& result)
{
- result.X = v.X;
- result.Y = v.Y;
- result.Z = v.Z;
- auto lenSq = result.LengthSquared();
+ result = v;
+ T lenSq = result.LengthSquared();
if (lenSq > max * max)
{
- auto scaleFactor = max / (float)Math::Sqrt(lenSq);
+ T scaleFactor = max / (T)Math::Sqrt(lenSq);
result.X *= scaleFactor;
result.Y *= scaleFactor;
result.Z *= scaleFactor;
}
if (lenSq < min * min)
{
- auto scaleFactor = min / (float)Math::Sqrt(lenSq);
+ T scaleFactor = min / (T)Math::Sqrt(lenSq);
result.X *= scaleFactor;
result.Y *= scaleFactor;
result.Z *= scaleFactor;