#### Archived

This topic is now archived and is closed to further replies.

# Box based collision...

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

## Recommended Posts

Hi all, I have another question for you I can''t figure out the good solution for. Assume you have a model. You figure out its box by finding min/max values for X, Y and Z and then use them to build a 3D box. Although you can do collision detection using it while the matrix of the model stays as identity one (4x4 matrix), the same box wouldn''t give a good and accurate collision detection when the object is rotated. The question is: should I go for sphere/ellipsoidal collision detection in that case (rotating), or how do I manually rotate vertices? I already know how to do scale, you just multiply scale values by vertex values, but I''m just not sure how to do rotation maths. Please also consider the use of full matrix (i.e displacement, rotation and scale) with model and the calculation of its box with that matrix. Thanks a lot. " Do we need us? "

##### Share on other sites
Manually rotating vertices... I think that would require a bit of 3D math, but nothing harder than a tad of trig! Look in the articles section of this site (Math section I believe). One of the articles has a bit of 3 dimensional point rotation.

##### Share on other sites
>>Assume you have a model. You figure out its box by finding min/max values for X, Y and Z and then use them to build a 3D box.
Although you can do collision detection using it while the matrix of the model stays as identity one (4x4 matrix), the same box wouldn''t give a good and accurate collision detection when the object is rotated.<<

there are 2 sorts of boxes used AABB (axis aligned) OOB (object)
youve described AABB which doesnt rotate (even if the object rotates)
OBB does rotate. when the object roates its a simple matter of updating the 3 OOB axis to the new orientation.

AABB - fast (for collision tests etc) but normally not a good fit for the object
OOBB - slower but usually fits the objects better

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

##### Share on other sites
OBB is of course a bit slower, but will prove to be much more usefull than AABB is practice. OBB has a much better fit for must cases, so if you want to approximate collision with complexe geometry, OBB might be reasonable in most case, AABB rarely.

Sphere are very usefull to implement, but has a limited fit, capped cylinder much more easier to implement than ellipse or true cylinder, and has a great fit, usually greater than OBB.

The best reference I know is the David Eberly web site.

http://www.magic-software.com/

##### Share on other sites
I do not know much about collision detection, but I prefer Ellipsis Collision Detection. I don''t know some pages with english tutorials, but be sure, if you search with google, you''ll find something reffering to that.
If you''re using ECD, the virtual world is scaled with some factors to make the ellipsis around the model a sphere and then you can do some pretty simple sphere collision detection.

##### Share on other sites
i personally like sphere collision detection, im still learning about collision detection but i think that sphere is really good, i made a small program that you tell the computer the x,y coordinates of the two circles and the radius and it will tell you if they are colliding, im still adding to it, so it will be applicable in my 3d apps

,Matt

-= kill one your a murderer, kill thousands your a conquerer =-

##### Share on other sites
Thanks to all for your replies, they all were really useful and informative to me, since I''m only starting on collision detection.
Best thanks to zedzeek for his explanation for various types of boxes, I''ll take a look online for OBB collision. Although I already figured out how to do scaling/displacement of object and hence its bound box, I''m not quite aware of an algorithm for detection of two boxes colliding.

Thanks all.

" Do we need us? "

##### Share on other sites
if i draw the boxes inside a push/popmatrix nest how could i get the absolute vertice values for the globalmatrix?

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

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633679
• Total Posts
3013294
×