summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2023-04-15 19:47:04 +0300
committerkartofen <mladenovnasko0@gmail.com>2023-04-15 19:47:04 +0300
commit27b4742f185a9780a975118093dc6fdce0575aeb (patch)
treecebbd7fd758c2d89319dd014d2d7a2ae29c02797
parentb1ae2b76d55c87133bc0c17bf7ef8b7545b759d0 (diff)
fixed another bug
-rw-r--r--src/sector.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sector.c b/src/sector.c
index 2f1a7fe..96efed4 100644
--- a/src/sector.c
+++ b/src/sector.c
@@ -174,8 +174,8 @@ void map_detect_collision(map_t *map)
// slide along the wall
if(sect->neighbors[i] == (size_t)-1
- || hole_high < player->pos.z + player->head_margin
- || hole_low - (player->pos.z - eyeheight ) > player->knee_height) {
+ || hole_low - (player->pos.z - eyeheight ) > player->knee_height
+ || hole_high - hole_low < eyeheight + player->head_margin) {
// formula from wikipedia
float xd = vert(s1).x - vert(s0).x, yd = vert(s1).y - vert(s0).y;
player->velocity.x = xd * (dx*xd + yd*dy) / (xd*xd + yd*yd);