Jump to content
  • Advertisement
Sign in to follow this  
be17_17y

collision detect using bounding box ...?

This topic is 4846 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 make bounding box for my character, to collide it with other object for example trees, do i have to make those trees bounding box too...? if that true...so for every single object in the world i want to use collision system.. have to own a bounding box/sphere ? isn't it consume much performance?

Share this post


Link to post
Share on other sites
Advertisement
Yes, for every item that you want to test for collision with you will need 1 or more bounding primitives (if it was a model of a person you would use many bounding primitives). The calculations for intersection are prety simple in most cases so it isnt that CPU intensive, especially when optimised.

Try here for intersection algorithms.

ace

Share this post


Link to post
Share on other sites
You will want every single object in your scene to have a both bounding box and a bounding sphere. Checking a bounding box against another bounding box, or a bounding sphere against another bounding sphere is orders of magnitude faster than going down to the polygon level to check for exact collisions, so its a good way of quickly eliminating the possibility of a collision between objects. Only if the bounding boxes/spheres intersect do you have to go down to a finer level of collision detection. So, it'll add performance and not consume it.

DirectX also has functions built in for computing the bounding boxes and spheres of your meshes for you:
Geometry.ComputeBoundingBox and Geometry.ComputeBoundingSphere

Share this post


Link to post
Share on other sites
A tree is a good example of a case where you really need two or more boxes. If you just have one around the whole tree collisions with the trunk will look wrong as they will happen to early so a box for the leafs and branches and another for the trunk would work better. This does make it more difficult to programatically create boxes from an arbitary mesh but you could split the tree into two. Often in games development artists will actually create the bounding shapes in the 3D package along with the model. you then load the model, detect the meshes that are bounding shapes and do not render them but use them to define the shapes.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!