Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

zaasz

collision detection

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

Hi, i would like to implememt collision detection into my engine (under Direct3D 9). But i have no idea how to do that. Can anybody help me? thanx

Share this post


Link to post
Share on other sites
Advertisement
Hi!

You could for example divide the world in a grid and let each cell in the grid remember what things that are in it. When you move something, you check if it collides with the contents of the new squares the thing will occupy, and in that case you take proper actions, e.g. prevents the thing from moving. Of course you''ll have to erase old cells which no longer are covered by the moving thing - it is actually quite tricky.

When you check whether the movable thing collides with the contents of a particular cell you could do an exact collision test between the movable and each thing in the cell. The easiest thing is probably to consider all things in your game to be made of spheres and to use a flat ground.

You could also use some more deliberate structure like a binary space partition tree (BSP tree), but then you''ll have to read about such datastructures on the internet.

A tutorial about collision detection (I didn''t like it very much but perhaps you do) is available at


http://nehe.gamedev.net/lesson.asp?index=06


Note:
You mentioned that you use Direct3D 9 - however, it does not matter what graphics engine you use since you''ll have to do everything yourself anyway.

Keen regards,
Magnus

Share this post


Link to post
Share on other sites

  • 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!