Jump to content
  • Advertisement
Sign in to follow this  
Hunter789

Map boundaries collision detection

This topic is 2718 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 there, first real post here ;) I need to develop a simple 2d 'playable character' vs. 'map boundaries' collision detection system. Our current system uses circle vs. line detection (the system forbids the player to move when it detects a collision), but it has big flaws when it comes to line intersection. To make the problem short, the character can slip between the two lines, making her trapped the other side of the boundaries (trapped within a decor element, or outside the map… etc.). What I’d like is a system that 'allows' player to move, instead of a system that 'prevents' a player from moving. Someone told me that having a black/white bitmap scaled to the map could be an option (the character can move to the destination only if it’s a white spot). The idea is interesting, but the space that the bitmap takes up might be an issue (we're developing for the Nintendo DS), even if I simplify the bitmap concept to an "array" of bits. Techniques I've thought about include: - Output the map as a big polygon and check for intersection each step before moving the character. - Output the map as a series of triangles, and check each step if the desired destination is on one of them. Are there other techniques? I'd like to know where to start looking for this kind of needs, as I've never done such a system. We're using 3ds max with export scripts to make our maps with their boundaries, so creating a script for 3ds max is not really a problem.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Hunter789
To make the problem short, the character can slip between the two lines, making her trapped the other side of the boundaries (trapped within a decor element, or outside the map… etc.).

Does this slipping occur because the characters sphere travelled too far in one frame, thereby passing through line segments? If so, try performing a sweep test, and check how far the characters sphere can travel before it hits anything. Then only allow it to travel that far, rather than completely disallowing movement. Having polygons covering the solid areas would be a good extra line of defense.

Share this post


Link to post
Share on other sites
Ok, thanks Captain P, will try check into it next time I get the chance! (Sorry for the ~1 year delay in the reply ;)

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!