Jump to content
  • Advertisement
Sign in to follow this  
GamerYZ

AABB collision help!

This topic is 4420 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

I'm building an AABB tree for my 3D engine, and I need some pointers on optimizing it. First of all, my program is blowing up and getting "no memory" error if I attempt to put a reasonable amount(10 - 20 or so) of triangles into a single box, while the total triangle is around 4000ish. Secondly, how should I traverse through the tree and check for line-box collision? Currently my collision check actully runs alot shower then traversing the whole tree. Someone please give me some pointers, thanks.

Share this post


Link to post
Share on other sites
Advertisement
If your tree is tight, then you could store node adjacency information in each node and use it to jump from node to node as you follow the line through space.

Share this post


Link to post
Share on other sites
Post your ray->aabb testing algorithm.

A Simple rule of thumb is that for a ray and an aabb to colide it must collide on every axis.

if this is your box with sides ABCD

-------
| C |
|A B|
| D |
|-----|


And we have ray OP then you can perform the following quick exit tests


if ((O.x < A.X) && (P.x < A.x)) return false; // No collision
if ((O.x > B.X) && (P.x > B.x)) return false; // No collision
if ((O.y > D.y) && (P.y > D.y)) return false; // No collision
.....



You get the idea, this is the MAIN advantage of having an AABB.. You have many early out tests.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!