Thursday, April 3, 2014

The Collision Box of Blocks

Although the collision of blocks may seem perfectly square, the actual hitbox that all blocks in the game have looks very similar to this:
Color Labels
Black is definite collision, blue is second layer collision ("dermis" collision if you will), light blue is where the middle of the block starts, gray is the definite middle, and green is free, where no collision checks occur

The Upper Section of the Block
Since the game can only check so far into each side for collision, it has to preserve its collision check so that it doesn't go so far that when one definite collision is happening others may happen as well, not representing actual collision.  This leeway for the top of the block is two pixels.  Two pixels from the left and right side of the block, the game will check for collision on the top of the block, and two pixels down, it will check for left and right collision.  There is a two pixel space in which nothing happens.  No collision is going to be checked in this region, and cancelling an air catch in this space will allow one to fly in from the left, corner clip it, and still not lose air.  They will not lose speed from the right because when you are in the middle of the block in which is not the two pixel free space, the game is told to push the player left automatically, but without affecting his speed.

The Bottom Section of the Block
From the bottom of the block, there is a larger region of collision, but no free space, which makes it near impossible to clip (besides if mario is on yoshi, in which there is a space where the two hitboxes make a "do nothing" region as well, where you may perform what is known as a block clip).
There are four pixels of leeway when it comes to the bottom of the block when it comes to the separation of bottom collision from side collision, but the game still pushes you out if you are in the diagonal area, unlike the top.

No comments:

Post a Comment