Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 739843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:26:49+00:00 2026-05-14T08:26:49+00:00

Been working on this problem of collision detection and there appears to be 3

  • 0

Been working on this problem of collision detection and there appears to be 3 main approaches I could take:

  1. Sprite and mask approach. (AND the overlap of the sprites and check for a non-zero number in the resulting sprite pixel data).

  2. Bounding circles, rectangles or polygons. (Create one or more shapes that enclose the sprites and do the basic maths to check for overlaps).

  3. Use an existing sprite library.

The first approach, even though it would have been the way I would have done it in the old days of 16×16 sprite blocks, it appears that there just isn’t an easy way of getting at the individual image pixel data and/or alpha channel within Quartz (or OPENGL for that matter). Detecting the overlap of the bounding box is easy, but then creating a 3rd image from the overlap and then testing it for pixels is complicated and my gut feel is that even if we could get it to work would be slow. Am I missing something neat here?

The second approach involves dividing up our sprites into several polygons and testing them for overlaps. The more polygons the more accurate the collision detection. The benefit is that it is fast, and can be accurate. The downside is it makes the sprite creation more complicated. i.e., we have to create the polygons for each sprite. For speed the best approach is to create a tree of polygons.

The 3rd approach I’m not sure about as it involves buying code (or using an open source licence). I am not sure what the best library to use is or whether this would make life easier or give us a problem integrating this into our app.

So in short I am favouring the polygon and tree approach and would appreciate you views on this before I go and write lots of code.

Best regards

Dave

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:26:50+00:00Added an answer on May 14, 2026 at 8:26 am

    Consider polygonizing your sprites. Keep a polygonal representation for your sprites “in the background” and do collision testing with the polygonized version of your game world. This produces some overhead and additional complexity, but is often very rewarding in terms of additional possibilities. (dynamic shadows, lighting effects, collision detection independent of sprite graphics, many more collision detection methods, polygonal intersection etc.)

    Otherwise you are stuck with the pixel based approach you described, which is also not bad.
    (ORing the overlap) You can just do it on your own or let OpenGL do it in the frame buffer. (I can’t remember the calls, think it was called z-masking (?), … sorry.
    For small sprites this might even be slower…) Consider using binary space partitioning techniques in order to optimize some of it:

    Quad trees for example, allow you to quickly find the candidate sprites for collision testing. They are applicable on both the pixel and vertex based approach.
    Or just use BSPTrees.

    Btw: I think pixel precision on collision detection is actually a nice feature, I used it a lot in Jump’n Runs. Maybe not applicable to your game, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working on this problem for quite a while but have not been
I have been working on this problem for 2 days now and it's an
I have been working on this problem for a while now. I am trying
I've been working on this problem most of the morning and I think I
I've been working on this problem for a few hours and have used many
I have been working on the following problem from this book . A certain
I have been working on this problem for a while but still no joy.
This problem has been KILLING me. I've been working on this app for 8
Ive been working at this problem for about a week, I have looked up
I've been working on this problem for so long, I've missed the entire football

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.