Jump to content
  • Advertisement
Sign in to follow this  
xissburg

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!