Skip to content

Instantly share code, notes, and snippets.

@Ratstail91
Created July 16, 2012 03:43
Show Gist options
  • Save Ratstail91/3120337 to your computer and use it in GitHub Desktop.
Save Ratstail91/3120337 to your computer and use it in GitHub Desktop.
BBox Pseudocode
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