Jump to content
  • Advertisement


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


Collision detection checks

This topic is 5233 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 all, I am designing a collision detection algorithm. So far I have this bashed out. The game world will be divided into zones. Each zone will contain the boundary areas for objects. (note this is for a simple pac-man type game so at the moment am not too bothered about getting collision between individual objects) When a player enters a new zone an array containg the positions for all these boundary areas will be created. Each frame the game checks to see if the player has entered any one of the local boundaries. BUT, I would like at some point to do a more accurate check. For example if one of the objects within an area is of an irregular shape. Can anyone offer any advice on what the best way to do this is. And if anyone is prepared to jot down a little sample code I would be very happy. I suppose the best way is to get all the poly''s for each object and see if any intersect. But a. I don''t know how to get the poly information, b. I''m not too sure how I would check if they were intersecting. Thanks all, any (nice) comments greatly appreciated. DRb2k2

Share this post

Link to post
Share on other sites
for a more generic collision detection, have a look at http://www.gamedev.net/community/forums/topic.asp?topic_id=215006

irregular shapes can be represented as segments, or segment loops for polygons. You can simplify the character (pacman, or pacgirl) as a sphere or box, and do collision tests between the box and the segments near to it. Then you move the sphere/box away from the intersecting segments. It''s quite similar to 3D collision detection, but in 2D . So if you move to 3D, you''ll be in (sort of) familiar territory, except it becomes a lot more maths intensive

you can also base your col det on pixels and sprites, but that''s a different matter, and I''ve never done it before, so hopefully, someone else can help you out on that one.

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!