#### Archived

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.

## 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 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.

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 23
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631768
• Total Posts
3002244
×