Right, so I've been doing some serious research into this subject and I've come across this:
http://answers.unity3d.com/questions/176953/thin-objects-can-fall-through-the-ground.html
I'd imagine that this seems to be occurring due to the size of the bullets. The mac shoots bullets that are 3x3 pixels in size, so it seems that
due to the slightly randomized Y velocity each bullet is given as it is created, some of them just clip through the floor. I've found that if I preference
the Y penetration over X penetration in my code, it takes preference of collision with corners. In other words, the lines:
penetration.X = (collisionRectangle.Width / 2) + (currentTile.Rectangle.Width / 2) - Math.Abs(detection.X);
penetration.Y = (collisionRectangle.Height / 2) + (currentTile.Rectangle.Height / 2) - Math.Abs(detection.Y);
can have a slight change here:
penetration.Y = (collisionRectangle.Height / 2) + (currentTile.Rectangle.Height / 2) - Math.Abs(detection.Y) - 5;
causing the Y penetration to take slight preference over the X penetration. This means that when the player rolls up a wall, he no longer has a weird clipping
issue with corners, and automatically pulls himself onto ledges if there's a 5-pixel gap involved, shown here:
http://giphy.com/gifs/d2YX8ZlN2gD37x9S
This also creates a larger margin to check for collisions with the top or bottom of a tile, meaning that with this in play, bullets no longer fall through the floor or
fly up through the ceiling. However, clipping is now more likely to occur with left and right collisions:
http://giphy.com/gifs/d2Z9hH2IrRE9Y4qQ
Now, this is interesting, as the exact inverse can also apply. If I change the other line of code to:
penetration.X = (collisionRectangle.Width / 2) + (currentTile.Rectangle.Width / 2) - Math.Abs(detection.X) - 5;
Then the X penetration now has a bias over the Y penetration, meaning that if an object is at the corner of a block, it preferences moving to the left or right (whichever is nearest) and drags from the top or bottom, shown here:
http://giphy.com/gifs/26tPe8JwTgOFeZQbK
Also, with this in place, bullets now never clip through the right or left parts of a wall, but fall through the ground/ceiling much more often:
http://giphy.com/gifs/26tPs3a88YPcP9bvG
=====================================
I'd also just like to mention something else. I'm almost certain that using contact lists won't actually help fix the problem at all. This is because the right/left checkers
of the wall ONLY affect the object's x-axis, and the top and bottom ONLY affect the y-axis, so touching multiple tiles at once should not cause any sort of conflict of interest.
I think the problem seems to be the bullet-through-paper issue that was mentioned earlier. I've tested a few things, and I've noticed that bigger objects are allowed to move
faster without clipping through walls, and smaller objects are not allowed to move as quickly, since they have more chance of completely skipping through a tile and never
performing a collision check in the first place.
My friends and I are currently trying to crack this problem, and we'd like to try a method which prevents bullet-through-paper issues. Bearing in mind that we're really not
professionals by any standard, could you guys possibly recommend some kind of tutorial or simple solution to this problem? I looked at your code, pluspingya, but I don't really understand what it does.
I was thinking of possibly storing the previous positions of all objects in a buffer, then checking to see if there's a tile in-between the current iteration and past iteration on every update, but would this be CPU-intensive? Is there a more graceful solution? Look forward to your replies!