diff --git a/Source/Engine/Core/Math/BoundingBox.cpp b/Source/Engine/Core/Math/BoundingBox.cpp
index df6150cf5..04b404622 100644
--- a/Source/Engine/Core/Math/BoundingBox.cpp
+++ b/Source/Engine/Core/Math/BoundingBox.cpp
@@ -13,6 +13,26 @@ String BoundingBox::ToString() const
return String::Format(TEXT("{}"), *this);
}
+void BoundingBox::GetCorners(Vector3 corners[8]) const
+{
+ corners[0] = Vector3(Minimum.X, Maximum.Y, Maximum.Z);
+ corners[1] = Vector3(Maximum.X, Maximum.Y, Maximum.Z);
+ corners[2] = Vector3(Maximum.X, Minimum.Y, Maximum.Z);
+ corners[3] = Vector3(Minimum.X, Minimum.Y, Maximum.Z);
+ corners[4] = Vector3(Minimum.X, Maximum.Y, Minimum.Z);
+ corners[5] = Vector3(Maximum.X, Maximum.Y, Minimum.Z);
+ corners[6] = Vector3(Maximum.X, Minimum.Y, Minimum.Z);
+ corners[7] = Vector3(Minimum.X, Minimum.Y, Minimum.Z);
+}
+
+BoundingBox BoundingBox::MakeOffsetted(const Vector3& offset) const
+{
+ BoundingBox result;
+ result.Minimum = Minimum + offset;
+ result.Maximum = Maximum + offset;
+ return result;
+}
+
void BoundingBox::FromPoints(const Vector3* points, int32 pointsCount, BoundingBox& result)
{
ASSERT(points && pointsCount > 0);
diff --git a/Source/Engine/Core/Math/BoundingBox.h b/Source/Engine/Core/Math/BoundingBox.h
index 4652bb3f6..575f484fa 100644
--- a/Source/Engine/Core/Math/BoundingBox.h
+++ b/Source/Engine/Core/Math/BoundingBox.h
@@ -76,17 +76,7 @@ public:
/// Gets the eight corners of the bounding box.
///
/// An array of points representing the eight corners of the bounding box.
- void GetCorners(Vector3 corners[8]) const
- {
- corners[0] = Vector3(Minimum.X, Maximum.Y, Maximum.Z);
- corners[1] = Vector3(Maximum.X, Maximum.Y, Maximum.Z);
- corners[2] = Vector3(Maximum.X, Minimum.Y, Maximum.Z);
- corners[3] = Vector3(Minimum.X, Minimum.Y, Maximum.Z);
- corners[4] = Vector3(Minimum.X, Maximum.Y, Minimum.Z);
- corners[5] = Vector3(Maximum.X, Maximum.Y, Minimum.Z);
- corners[6] = Vector3(Maximum.X, Minimum.Y, Minimum.Z);
- corners[7] = Vector3(Minimum.X, Minimum.Y, Minimum.Z);
- }
+ void GetCorners(Vector3 corners[8]) const;
///
/// Calculates volume of the box.
@@ -200,13 +190,7 @@ public:
///
/// The offset.
/// The result.
- BoundingBox MakeOffsetted(const Vector3& offset) const
- {
- BoundingBox result;
- result.Minimum = Minimum + offset;
- result.Maximum = Maximum + offset;
- return result;
- }
+ BoundingBox MakeOffsetted(const Vector3& offset) const;
public:
@@ -421,6 +405,26 @@ public:
{
return CollisionsHelper::BoxContainsSphere(*this, sphere);
}
+
+ ///
+ /// Determines the distance between a Bounding Box and a point.
+ ///
+ /// The point to test.
+ /// The distance between bounding box and a point.
+ FORCE_INLINE float Distance(const Vector3& point) const
+ {
+ return CollisionsHelper::DistanceBoxPoint(*this, point);
+ }
+
+ ///
+ /// Determines the distance between two Bounding Boxed.
+ ///
+ /// The bounding box to test.
+ /// The distance between bounding boxes.
+ FORCE_INLINE float Distance(const BoundingBox& box) const
+ {
+ return CollisionsHelper::DistanceBoxBox(*this, box);
+ }
};
template<>