diff --git a/Source/Engine/Core/Math/CollisionsHelper.cpp b/Source/Engine/Core/Math/CollisionsHelper.cpp
index 36a0b0182..d485e5fba 100644
--- a/Source/Engine/Core/Math/CollisionsHelper.cpp
+++ b/Source/Engine/Core/Math/CollisionsHelper.cpp
@@ -15,7 +15,7 @@ void CollisionsHelper::ClosestPointPointLine(const Vector2& point, const Vector2
Vector2 n = p1 - p0;
const float length = n.Length();
- if (length < 1e-10)
+ if (length < 1e-10f)
{
// Both points are the same, just give any
result = p0;
@@ -24,7 +24,7 @@ void CollisionsHelper::ClosestPointPointLine(const Vector2& point, const Vector2
n /= length;
const float dot = Vector2::Dot(n, p);
- if (dot <= 0.0)
+ if (dot <= 0.0f)
{
// Before first point
result = p0;
@@ -48,25 +48,24 @@ Vector2 CollisionsHelper::ClosestPointPointLine(const Vector2& point, const Vect
return result;
}
-
void CollisionsHelper::ClosestPointPointLine(const Vector3& point, const Vector3& p0, const Vector3& p1, Vector3& result)
{
const Vector3 p = point - p0;
Vector3 n = p1 - p0;
const float length = n.Length();
- if (length < 1e-10)
+ if (length < 1e-10f)
{
result = p0;
return;
}
n /= length;
const float dot = Vector3::Dot(n, p);
- if (dot <= 0.0)
+ if (dot <= 0.0f)
{
result = p0;
return;
}
- else if (dot >= length)
+ if (dot >= length)
{
result = p1;
return;
@@ -903,7 +902,6 @@ bool CollisionsHelper::RayIntersectsBox(const Ray& ray, const BoundingBox& box,
d = Math::Abs(size.Z - Math::Abs(localPoint.Z));
if (d < dMin)
{
- dMin = d;
normal = Vector3(0, 0, Math::Sign(localPoint.Z));
}
@@ -1072,15 +1070,11 @@ PlaneIntersectionType CollisionsHelper::PlaneIntersectsBox(const Plane& plane, c
min.Z = plane.Normal.Z >= 0.0f ? box.Maximum.Z : box.Minimum.Z;
float distance = Vector3::Dot(plane.Normal, max);
-
if (distance + plane.D > Plane::DistanceEpsilon)
return PlaneIntersectionType::Front;
-
distance = Vector3::Dot(plane.Normal, min);
-
if (distance + plane.D < Plane::DistanceEpsilon)
return PlaneIntersectionType::Back;
-
return PlaneIntersectionType::Intersecting;
}
@@ -1094,10 +1088,8 @@ PlaneIntersectionType CollisionsHelper::PlaneIntersectsSphere(const Plane& plane
if (distance > sphere.Radius)
return PlaneIntersectionType::Front;
-
if (distance < -sphere.Radius)
return PlaneIntersectionType::Back;
-
return PlaneIntersectionType::Intersecting;
}
@@ -1105,13 +1097,10 @@ bool CollisionsHelper::BoxIntersectsBox(const BoundingBox& box1, const BoundingB
{
if (box1.Minimum.X > box2.Maximum.X || box2.Minimum.X > box1.Maximum.X)
return false;
-
if (box1.Minimum.Y > box2.Maximum.Y || box2.Minimum.Y > box1.Maximum.Y)
return false;
-
if (box1.Minimum.Z > box2.Maximum.Z || box2.Minimum.Z > box1.Maximum.Z)
return false;
-
return true;
}
diff --git a/Source/Engine/Core/Math/CollisionsHelper.h b/Source/Engine/Core/Math/CollisionsHelper.h
index 06b69741f..4bebf2492 100644
--- a/Source/Engine/Core/Math/CollisionsHelper.h
+++ b/Source/Engine/Core/Math/CollisionsHelper.h
@@ -126,7 +126,7 @@ public:
/// The point to test.
/// When the method completes, contains the closest point between the two objects.
static void ClosestPointPlanePoint(const Plane& plane, const Vector3& point, Vector3& result);
-
+
///
/// Determines the closest point between a and a point.
///
@@ -142,7 +142,7 @@ public:
/// The point to test.
/// When the method completes, contains the closest point between the two objects.
static void ClosestPointBoxPoint(const BoundingBox& box, const Vector3& point, Vector3& result);
-
+
///
/// Determines the closest point between a and a point.
///
@@ -158,7 +158,7 @@ public:
/// The point to test.
/// When the method completes, contains the closest point between the two objects.
static void ClosestPointRectanglePoint(const Rectangle& rect, const Vector2& point, Vector2& result);
-
+
///
/// Determines the closest point between a and a point.
///
@@ -174,7 +174,7 @@ public:
/// The point to test.
/// When the method completes, contains the closest point between the two objects; or, if the point is directly in the center of the sphere, contains .
static void ClosestPointSpherePoint(const BoundingSphere& sphere, const Vector3& point, Vector3& result);
-
+
///
/// Determines the closest point between a and a point.
///
@@ -195,7 +195,7 @@ public:
/// intersection.
///
static void ClosestPointSphereSphere(const BoundingSphere& sphere1, const BoundingSphere& sphere2, Vector3& result);
-
+
///
/// Determines the closest point between a and a .
///