# Box Box Collision Detection (3D)

This topic is 4782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Having two or more boxes that can translate and rotate itself in all axis (xyz), what is the best (or good:) way of find collisions in the system? I thought about create an imaginary sphere around them with a radius equal the distance between the box center of mass and any vertex of it and calc a simple sphere-sphere collision detection just to minimize calculations. Then, if the distance between two boxes be lower than box1sphereRadius+box2sphereRadius, I begin the more hardcore computation. I thought about take the box vertices positions in the previous frame and in the actual frame and make some segments, and then calc segment-triangle intersection with the another box...I think it will not work correctly and I'm getting a bit confused when creating the algorithms :P So, what is a good method?!? Thanks a lot....

##### Share on other sites
I would recommend finding a transformation that makes one of the boxes axis-aligned, transform both of the boxes and then check several of the non-axis-aligned box's points to see if they are inside the axis-aligned one.

The transformation would be something like

v1.x v2.x v3.x

v1.y v2.y v3.y

v1.z v2.z v3.z

where v1,v2, and v3 are the vectors from the center of your box to the center of its sides. The other 3 vectors will be the same except negative; you can ignore them. It shouldn't matter if the matrix also scales as long as you use the same matrix to transform both boxes.

##### Share on other sites
In general, segment-tri or segment-plane tests shouldn't be necessary (unless perhaps you're doing some sort of clipping). You can get boolean, static, and swept intersection, including contact information, by other means. You might start with the separating axis theorem.

1. 1
2. 2
Rutin
15
3. 3
4. 4
5. 5

• 9
• 9
• 14
• 12
• 10
• ### Forum Statistics

• Total Topics
633269
• Total Posts
3011153
• ### Who's Online (See full list)

There are no registered users currently online

×