diff --git a/core/include/cubos/core/geom/capsule.hpp b/core/include/cubos/core/geom/capsule.hpp index ec967b9a2..0d92829cb 100644 --- a/core/include/cubos/core/geom/capsule.hpp +++ b/core/include/cubos/core/geom/capsule.hpp @@ -37,8 +37,8 @@ namespace cubos::core::geom AABB aabb() const { AABB aabb; - aabb.min({-radius, -radius, -radius}); - aabb.max({radius, radius + length, radius}); + aabb.min({-radius, -radius - (length / 2.0F), -radius}); + aabb.max({radius, radius + (length / 2.0F), radius}); return aabb; } }; diff --git a/engine/samples/collisions/main.cpp b/engine/samples/collisions/main.cpp index 29632e91c..fe0a20426 100644 --- a/engine/samples/collisions/main.cpp +++ b/engine/samples/collisions/main.cpp @@ -128,7 +128,9 @@ static void render(Query, Read> query) { for (auto [entity, localToWorld, collider] : query) { - cubos::core::gl::Debug::drawWireBox(collider->localAABB.box(), localToWorld->mat * collider->transform); + cubos::core::gl::Debug::drawWireBox( + collider->localAABB.box(), + glm::translate(localToWorld->mat * collider->transform, collider->localAABB.center())); cubos::core::gl::Debug::drawWireBox(collider->worldAABB.box(), glm::translate(glm::mat4{1.0}, collider->worldAABB.center()), glm::vec3{1.0, 0.0, 0.0});