Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

detz

macrumors 65816
Original poster
Jun 29, 2007
1,051
0
Can someone give me pointers on this, bounding box is easy but it's not "accurate".
 

firewood

macrumors G3
Jul 29, 2003
8,141
1,384
Silicon Valley
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...
 

liptonlover

macrumors 6502a
Mar 13, 2008
989
0
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?
 

detz

macrumors 65816
Original poster
Jun 29, 2007
1,051
0
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.
 

detz

macrumors 65816
Original poster
Jun 29, 2007
1,051
0
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...

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.
 

liptonlover

macrumors 6502a
Mar 13, 2008
989
0
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.