Jump to content
  • Advertisement


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


Multi-Frame Collision Prediction

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

Well, this is pretty much 2 problems disguised in one. As I attempt to program an extremely flexible 2D player engine I need it to support accurate collision detection, which probably requires collision prediction [and I''m using deltatime movement]. The other problem is that the player object is going to be animated using a couple of frames that may vary in size. So do I need accurate per pixel collision detection, or more like pixel collision prediction? I''m pretty sure I can write an algorithm that''d do both but it would require a Pentium IV 2.4 GB Mhz to run smoothly.. Is there an efficient way to do this?

Share this post

Link to post
Share on other sites
By 2D game I''m going to assume that you''re using tiles to represent your level in some capacaity.

If this is the case then you can actually do some pretty fast collision detection that is very accurate.

What you have to do is check for a general collision once every tile width/height (like a raycaster would). If you find one, refine the detection to be per-pixel within that tile only. This way you''re not actually looking for per-pixel collisions on every single tile-- only potential hits.

In terms of your player animating, I guess it really depends on how accurate you want the collision detection to be. Since you''re dealing with animated sprites just figure out what frame the sprite would be in when you''re checking for the collision against your tile, and do the per-pixel that way.

You shouldn''t need a 2.4 GHz pentium to do this.

Hope this has helped,

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!