Work on bouncing debris

This commit is contained in:
2025-08-02 22:14:25 +01:00
parent eeb7c8ac88
commit 5722ca8204
13 changed files with 141 additions and 1090 deletions
+3 -3
View File
@@ -91,8 +91,8 @@ collide3 sp ep w = collide3Floors sp (w ^. cWorld . chasms)
collide3Walls :: Point3 -> World -> (Point3, Maybe Point3) -> (Point3, Maybe Point3)
collide3Walls sp w (ep,mn) = collide3Part sp wsfs (ep,mn)
where
wsfs = fmap f $ wlsNearSeg (xyV3 sp) (xyV3 ep) w
f wl = (g x, g $ vNormal (y-x), [(g x,g (y-x)),(g y,g (x-y))])
wsfs = f <$> wlsNearSeg (xyV3 sp) (xyV3 ep) w
f wl = (g x, g $ vNormal (x-y), [(g x,g (y-x)),(g y,g (x-y))])
where
g = (`v2z` 0)
(x,y) = _wlLine wl
@@ -104,7 +104,7 @@ collide3Floors sp cs (ep,mn) = maybe (ep,mn) (,Just (V3 0 0 1)) mp
V3 x y z <- intersectSegPlane sp ep (V3 0 0 0) (V3 0 0 1)
let g (a,b) = isRHS a b (V2 x y)
f = any g
guard (all f $ map loopPairs cs)
guard (all (f . loopPairs) cs)
return $ V3 x y z
collide3Part :: Point3 -> [(Point3,Point3,[(Point3,Point3)])]