I'm trying to find the most efficient way to check if 2 arbitrarily sized cubes collide with each other. The sides of the cubes are not necessarily all equal in length (a box is possible). Given these constraints, how could I efficiently check if they collide? (each box has 24 verticies) Thanks
They are axis alligned
Since both boxes are axis-aligned you can just compare their extents:
return (a.max_x() >= b.min_x() and a.min_x() <= b.max_x())
and (a.max_y() >= b.min_y() and a.min_y() <= b.max_y())
and (a.max_z() >= b.min_z() and a.min_z() <= b.max_z())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With