Work on gibs and chasms

This commit is contained in:
2025-08-01 09:39:13 +01:00
parent 7110ddb7a6
commit eeb7c8ac88
22 changed files with 586 additions and 373 deletions
+24
View File
@@ -1,13 +1,37 @@
module Dodge.Prop.Moving (
fallSmallBounceDamage,
fallSmallBounce,
updateDebrisChunk,
) where
import Linear.Metric
import Linear.V3
import Dodge.Damage
import Dodge.Base
import Dodge.Data.World
import Geometry
import LensHelp
import Control.Monad
updateDebrisChunk :: World -> Debris -> (World, Maybe Debris)
updateDebrisChunk w db = (w, mdb)
where
cdb'
| norm sv < 0.5 && abs (sp ^. _z) < 0.5 = db
| otherwise = cdb
sv = db ^. dbVel
sp = _dbPos db
np = sp + sv
cdb = case collide3 sp np w of
(p,Nothing) -> db & dbPos .~ p
& dbVel -~ V3 0 0 1
& dbRot %~ dospin
(p,Just n) -> db & dbPos .~ p + (0.0001 * normalize n)
& dbVel .~ (0.7 * reflectInNormal n sv) - V3 0 0 1
dospin = (_dbSpin db *)
mdb = do
guard (np > -100)
return $ cdb'
fallSmallBounceDamage :: Prop -> World -> World
fallSmallBounceDamage pr w =