Separate names with a comma.
Discussion in 'iOS Programming' started by detz, Oct 14, 2008.
Can someone give me pointers on this, bounding box is easy but it's not "accurate".
Selective search through recursively smaller and smaller bounding boxes (divide each bounding rectangle in quarters, if you like). If you find a hit in any box, look for hits between any smaller boxes in the overlap rect, and recurse till you get down to a few pixels. If you don't get a hit, skip going any deeper/finer.
at least that's one method...
Just curious, is this for getting better collisions, like on an object with curved sides/complicated shape, or is it because the user will sometimes see an object go into another before recognizing the collision?
Well...both, but I'm more concerned with the first one, odd shaped objects getting hit when they shouldn't because of the bounding box. My "fix" has been to create smaller bounding boxes within but even that's not accurate on round or pointed shapes.
That's what I'm kind of doing but it's not that accurate...I also wondering if that is slower than comparing two masks but I can't figure out how to get pixel information to actually check collisions.
I'm curious too then, for future reference.
With the second problem though, just add a correction phase between collision checking and displaying. So it checks for collision, if the collision went too far, make a correction, then display it. I've only done this for simple 2D block collisions in a very small, very uncompleted mario remake I started, but it worked.