Stop bullets when they hit walls

This commit is contained in:
2021-12-14 19:25:37 +00:00
parent 47391f3850
commit e3402bacf1
8 changed files with 64 additions and 21 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ wallNormal wl = normalizeV . vNormal $ a -.- b
wallsOnLine :: Point2 -> Point2 -> IM.IntMap Wall -> [Wall]
wallsOnLine p1 p2 ws = hitWalls
where
hitPoint w = uncurry (intersectSegSeg p1 p2) (_wlLine w)
hitPoint = uncurry (intersectSegSeg p1 p2) . _wlLine
hitWalls = filter (isJust . hitPoint) (IM.elems ws)
wallsOnLine3D :: Point3 -> Point3 -> IM.IntMap Wall -> [Wall]