Created
July 16, 2012 03:43
-
-
Save Ratstail91/3120337 to your computer and use it in GitHub Desktop.
BBox Pseudocode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BBox::GetWorldBBox(): | |
return world bbox | |
end | |
BBox::CheckCollisionType( box ): | |
myBox = GetWorldBBox() | |
//I know this part | |
if inside return inside | |
if outside return outside | |
if edge return edge | |
return false | |
end | |
BBox::CheckCollisionSide( box ): | |
//check what side of this box the other box is on | |
myBox = GetWorldBBox() | |
//make sure that this IS a collision first | |
if CheckCollisionType() == false return false | |
//above | |
if ( | |
closer to the top than the bottom && | |
closer to the top than the sides | |
) | |
return above | |
//right | |
//bottom | |
//left | |
end | |
------------------------- | |
CheckCollisionType() returns the type of the collision | |
CheckCollisionSide() returns the side of the collision |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment