Comment on why we need overlapping collision rectangles.
This commit is contained in:
parent
4e03580df1
commit
d6ef557a1c
@ -1112,6 +1112,7 @@ geom2d::rect<int>Crawler::GetTileCollision(MapName map,vf2d pos,bool upperLevel)
|
|||||||
if(foundRect.pos==NO_COLLISION.pos&&foundRect.size==NO_COLLISION.size){
|
if(foundRect.pos==NO_COLLISION.pos&&foundRect.size==NO_COLLISION.size){
|
||||||
foundRect=collisionRect;
|
foundRect=collisionRect;
|
||||||
}else{
|
}else{
|
||||||
|
//When we find another rectangle in the same square, we expand it to consume the area, whichever tile creates a larger surface or the combination of the two.
|
||||||
foundRect.pos.x=std::min(foundRect.pos.x,collisionRect.pos.x);
|
foundRect.pos.x=std::min(foundRect.pos.x,collisionRect.pos.x);
|
||||||
foundRect.pos.y=std::min(foundRect.pos.y,collisionRect.pos.y);
|
foundRect.pos.y=std::min(foundRect.pos.y,collisionRect.pos.y);
|
||||||
foundRect.size.x=std::max(foundRect.size.x,collisionRect.size.x);
|
foundRect.size.x=std::max(foundRect.size.x,collisionRect.size.x);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user