Box based collision...

Started by
6 comments, last by HellRiZZer 21 years, 3 months ago
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? "

Ionware Productions - Games and Game Tools Development

Advertisement
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.
>>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

google either should give more info on whole to use them




http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
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/

Cookie
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.
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 =-
-= kill one you're a murderer, kill thousands you're a conquerer =-
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? "


Ionware Productions - Games and Game Tools Development

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

This topic is closed to new replies.

Advertisement