summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-03 21:19:16 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-03 21:19:16 +0100
commit0def1496d54dfc3ea44d9f86b7e363663dc756cc (patch)
treee84d19e262a119d19c6c57de0726e38ac3e4a33f /src
parent879b4d9c629b59388caa202bfd72e1ca1c5992fa (diff)
fix collisions inside walls
Diffstat (limited to 'src')
-rw-r--r--src/tile-bbox.hpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tile-bbox.hpp b/src/tile-bbox.hpp
index 7f8a05b8..172203d8 100644
--- a/src/tile-bbox.hpp
+++ b/src/tile-bbox.hpp
@@ -30,14 +30,16 @@ constexpr Pair<Vector2, Vector2> whole_tile(size_t k)
constexpr Pair<Vector2, Vector2> wall_north(size_t k, float wall_depth)
{
- auto min = tile_start(k) - Vector2{0, wall_depth};
- return { min, min + Vector2{TILE_SIZE2.x(), wall_depth}, };
+ constexpr auto eps = Vector2(1e-6f);
+ auto min = tile_start(k) - Vector2{0, wall_depth} - eps;
+ return { min, min + Vector2{TILE_SIZE2.x(), wall_depth} + eps, };
}
constexpr Pair<Vector2, Vector2> wall_west(size_t k, float wall_depth)
{
- auto min = tile_start(k) - Vector2{wall_depth, 0};
- return { min, min + Vector2{wall_depth, TILE_SIZE2.y()}, };
+ constexpr auto eps = Vector2(1e-6f);
+ auto min = tile_start(k) - Vector2{wall_depth, 0} - eps;
+ return { min, min + Vector2{wall_depth, TILE_SIZE2.y()} + eps, };
}
} // namespace floormat