Reputation: 631
I've been following this for AABB collisions and translated it to 3D. However, I've found that the collision math doesn't work, and two boxes defined like this:
struct AABB player = {
.position = {10, 7, 10},
.half = {1.5, 1.5, 1.5} // 3^3 box
};
struct AABB box = {
.position = {10, 5, 10},
.half = {0.5, 0.5, 0.5} // 1^3 box
};
are said to not be colliding, when obviously, a 3x3x3 player should collide with a 1x1x1 box when the player is only 2 units above the other box. You can run and see the code here, where the result is not expected: https://godbolt.org/z/o9fMWodvT
Any idea why the collision detection isn't working properly would be greatly appreciated.
Upvotes: 0
Views: 55