diff --git a/interfaces/Crafter.Math-Intersection.cppm b/interfaces/Crafter.Math-Intersection.cppm index 9462d11..370cb9f 100755 --- a/interfaces/Crafter.Math-Intersection.cppm +++ b/interfaces/Crafter.Math-Intersection.cppm @@ -202,9 +202,9 @@ namespace Crafter { // Translate the sphere center into the OBB's local space Vector localCenter = Vector( - Vector::Dot(sphereCenter - Vector(boxMatrix.m[3][0], boxMatrix.m[3][1], boxMatrix.m[3][2]), xAxis), - Vector::Dot(sphereCenter - Vector(boxMatrix.m[3][0], boxMatrix.m[3][1], boxMatrix.m[3][2]), yAxis), - Vector::Dot(sphereCenter - Vector(boxMatrix.m[3][0], boxMatrix.m[3][1], boxMatrix.m[3][2]), zAxis) + Vector::Dot(sphereCenter - Vector(boxMatrix.m[0][3], boxMatrix.m[1][3], boxMatrix.m[2][3]), xAxis), + Vector::Dot(sphereCenter - Vector(boxMatrix.m[0][3], boxMatrix.m[1][3], boxMatrix.m[2][3]), yAxis), + Vector::Dot(sphereCenter - Vector(boxMatrix.m[0][3], boxMatrix.m[1][3], boxMatrix.m[2][3]), zAxis) ); // Clamp the local center to the OBB's extents diff --git a/interfaces/main.cpp b/interfaces/main.cpp index 57997c6..ebd3ac9 100644 --- a/interfaces/main.cpp +++ b/interfaces/main.cpp @@ -5,5 +5,9 @@ import std; using namespace Crafter; int main() { - + Vector sphereCenter(-10,0,0); + float sphereRadius = 10; + Vector boxSize(0,0,0); + MatrixRowMajor boxMatrix = MatrixRowMajor ::Translation(10,0,0); + std::cout << IntersectionTestSphereOrientedBox(sphereCenter, sphereRadius, boxSize, boxMatrix) << std::endl; } \ No newline at end of file