Sign in to follow this  
Structural

Collision detection methods

Recommended Posts

Structural    328
I finally got a reliable sphere-sphere collision detection and response going, and my question is... what next? I know there are a nr of other methods involving AABB's and simplified meshes (poly soup I read somewhere), but I don't know where to go. AABB's are fast, however, when rotating objects they become far from accurate. Are AABB's always aligned to the world axis? Also, in what order does one perform collision detection? Imagine, my world is seperated by a octree. Every object knows its outer radius, and every object has a simplified collision mesh. First selection is based on the leaf the object is in. Is it wise to even perform the sphere-sphere collision test? Or is it better to jump to the mesh-mesh collision test right away? Thirdly, about the spatial partitioning. Is every objects bounding volume tested if it still fits in the leaf every frame? So, do I test every frame if an object is still within a leaf, or is there a smarter way of doing this? TY.

Share this post


Link to post
Share on other sites
Motorherp    613
Quote:
what next?

Well AABB is certainly a smart way to go next. For a start its not much more compicated than sphere collision and also you'll probably need it if you plan on implementing an octree. Remeber to also code collision checks between different shape types as well, so in this example you'll not only want AABB-AABB but also Sphere-AABB. Then I'd go onto OBB collision which is a nice introduction into the world of seperating axis thoerem and also incredibly useful. You should then have all the knowledge you need to implement arbitrary convex mesh collision (simplified meshes). For some help with this stuff check out Magic Software.

Quote:
Also, in what order does one perform collision detection?

Its always best to start with simple bounding shapes and work your way down to tighter fitting but more expensive checks. This way you can quickly cull out many of the real CPU draining checks. What I would recommend is to wrap your objects with a bounding sphere at the top level and then approximate their shapes as best you can with OBBs beyond that (there's nothing to stop you using more that one OBB at this level, however best you can represent the render mesh). This is usually sufficient for most quick collision detection. Only if you want very accurate collision should you then go on to having a layer of convex volumes below this.

Quote:
Or is it better to jump to the mesh-mesh collision test right away?

no

Quote:
Thirdly, about the spatial partitioning. Is every objects bounding volume tested if it still fits in the leaf every frame? So, do I test every frame if an object is still within a leaf, or is there a smarter way of doing this?

Depends on the size of your leaf nodes compared to the size of your objects. If the leaf nodes are much larger it might be worth checking if the objects could possible leave the node they are currently in within a frame before recolliding them with the tree. Also unless your objects move very quickly it might be worth storing each leaf nodes neighbour pointers and just colliding each object with its last node and its last node's neighbours each frame rather than recolliding with the whole tree. These kind of optimisations are all very dependant on the type of game and objects you'll be handling as well as on the construction method used for the octree. The best thing to do is experiment and see for yourself what works best for your specific situation. Hope this helps

Share this post


Link to post
Share on other sites

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