Fix crWallCollisions by using a rectangle zone instead of a point

This commit is contained in:
2023-01-03 17:36:28 +00:00
parent 5fc39bd12d
commit 5b4e8d75bb
9 changed files with 58 additions and 35 deletions
+5 -3
View File
@@ -37,15 +37,17 @@ colCrWall w c
%~ pushOutFromCorners rad ls'
. pushOutFromWalls rad ls'
. fst
. flip (collidePoint p1) wls' -- check push throughs
. flip (collidePoint p1) wls -- check push throughs
-- . flip (collidePointWalls' p1) wls -- check push throughs
rad = _crRad c + wallBuffer
p1 = _crOldPos c
p2 = _crPos c
ls = _wlLine <$> wls
ls' = filter (uncurry $ isLHS p1) ls
wls' = filter (not . _wlWalkable) $ wlsNearPoint p2 w
wls = filter (not . _wlWalkable) $ wlsNearPoint p2 w
--wls = filter (not . _wlWalkable) $ wlsNearPoint p2 w
wls = filter (not . _wlWalkable) $ wlsNearRect (p2 +.+ V2 r r) (p2 -.- V2 r r) w
r = _crRad c
--wls = filter (not . _wlWalkable) $ IM.elems $ _walls $ _lWorld $ _cWorld w
--wallPoints = map fst ls