Inside3D!
     

bounding boxes pt 2

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> General Programming
View previous topic :: View next topic  
Author Message
boxrick



Joined: 20 Jan 2009
Posts: 5

PostPosted: Fri Mar 13, 2009 9:18 am    Post subject: bounding boxes pt 2 Reply with quote

http://forums.inside3d.com/viewtopic.php?t=1470

In reference to the above thread.

So once i have these colliding, i now wish to use an orientated bounding box as opposed to just the axis alined....

Everything i find on the internet seems to go into extremely complicated details instead of just actually explaining the basics...

So i have my bounding boxes in world space... each with 8 x y and z positions... i need to calculate when one corner goes through an edge or an edge goes through an edge..

Not quite as simple as just using the max and min values.... do i do this using something like using the 12 edges of the box ( equation of a line ) and checking if they intersect ... or am i going down totally the wrong route here?
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Fri Mar 13, 2009 1:11 pm    Post subject: Reply with quote

If it is just a bounding box, why bother to rotate it anyway?
If its not really a box, but rather an shape around a model, why not use a sphere type shape instead?

In quake (1/2/3) bounding boxes do not rotate. Ever.
Rotating bsp objects rotate by rotating the start and end points of traces into their orientation. This means that as the rotating bsp object rotates, the bounding boxes that light intersect it rotate too. But only for collisions with that bsp object.

Anyway, my point is that as an abstract concept to facilitate optimisations, bounding boxes do not need to rotate. The only rotation of a bounding box that really makes sense is one where the bbox was expanded to encompass the entire rotated object, but still not actually at an angle itself.

Unless you really are dealing with only cuboids, use bounding spheres for mosters, but honestly don't bother rotating bounding boxes - except for expanding the bbox to encompass the full rotation.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Fri Mar 13, 2009 1:40 pm    Post subject: Reply with quote

Spike: a very useful reason to add support for rotated bboxes would be physics. I wouldn't mind making Twig use those instead of particles. It'd obviously need to be made as separate builtins, for calling aligned box shape tracing (possibly even a rotating sweep, wohoo), and not replace the current bbox operations.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Fri Mar 13, 2009 4:02 pm    Post subject: Reply with quote

What's the difference between that and 'simply' tracing against meshes?
Imho the definition of a bounding box is a box specifying the maximum bounds of an object. In this context there is no need for it to rotate, only to expand with rotation (in quake the bbox is specified by the absmin/absmax vales).
If you want to blur stuff a bit, then a collision box is the box with which things will collide. Imho in Quake, this would actually be best represented with a cylinder. Which would not need to rotate, and would not need to push things out of the way in order to rotate. But yes, quake uses a non-rotating box, because a BSP tree is built from the other object's mins/maxs.

Triggers trigger when their bounding box is touched - because the bounding box is larger than the model actually is, allowing items to be grabbed off shelves (triggers have special touch code or they would never be touched). Nothing else uses the bounding box as anything but an optimisation, in quake. I think most games out there follow this behaviour.
By rotating the collision box, you are stating that the object is a box, and if its not, then you're just wasting cpu cycles.
And if it really is a box, why are you not using full mesh-based collisions instead?
If all you wanted was to stop the corners of collision boxes from getting in the way constantly, then use cylinders or spheres.[/i]
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Sat Mar 14, 2009 9:43 am    Post subject: Reply with quote

Well I don't know what boxrick was ultimately after, but I can imagine implementing aligned box collisions is easier than sweeping mesh collisions, and certainly faster. You can also cull the rotated box with a regular non-rotated bounding box, ofcourse.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> General Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group