Sign in to follow this  

Collision Detection inside of Hollow Bodies - best practice

This topic is 4335 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 have recently implemented some collision detection: * Object-Object using OBB (not hollow objects!) * Object Terrain using HeightMaps Now there is one last collision that I can't figure out how to test it: CD within hollow objects like rooms, dungeons etc. The OBB doesn't seem to be well suited for this problem, since the Bounding Boxes do not need to be ligned up with the ground itself and the room can be quite big which can result in deep OBB trees. What is the "best practice" to imptlement CD inside of buildings and rooms? thanks for your help, patrick

Share this post


Link to post
Share on other sites
Usually, it's done using per-triangle vs obb tests, with triangles stored in some kind of tree (AABB, octree, kd tree...). But you also have BSP trees constructs to do static mesh collisions.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Lol, I think to clear up what daft mentioned, the walls can each be tested against your OBB. Try creating a plane for each wall to use in your collision testing. A plane as you might know is just a flat surface pointing in a certain direction. Easy as crap to test against all bounding primitives that I know of.
Also, you will want to organize your walls as smartly as possible, so you don't have to test against all of them all the time. You could do a tree structure for that if you wanted, doesn't matter to me. But organize them by room so you first find the room(s) you are in, then test against only those walls.

To note, this is really imho the best solution for rooms (dungeons included) with defined walls, floors and ceiling (lots of flat surfaces for these). But suppose you had a cave level with really rough terrain that you wanted to test against. There might be far too many planes to place in this setting, and you might be better off simply testing your OBB with a BSP tree or other collision structure.

Also, regarding plane collision. You will want to pass the collision test only if you are on the correct side of the plane, as any sane plane collision test will tell you which side of the plane it is on if it isn't intersecting. That way you won't get players "slipping through a crack" in a wall or floor. I played Dark Age of Camelot for a while and they had a couple of these that we made use of a lot. >)

Good luck!
- Enosch

Share this post


Link to post
Share on other sites

hi all!

thanks for the replies! I will think about your suggestions and see what fits best in my framework.

I think extrapolating walls by planes would realy speed up the CD and if needed switching to the per triangle CD would give the required resolution on ruff terrain.

thx,
Patrick

Share this post


Link to post
Share on other sites
using just hyperplanes can be a problem, due to the objects being not trivial (non-convex, convave edges and corners in rooms). Hence the use of BSP trees, or per-triangle CD with added space partitioning (AABBtree, KD trees, ect...). best of luck.

Share this post


Link to post
Share on other sites

This topic is 4335 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this