This commit is contained in:
2025-12-02 22:40:17 +00:00
parent fd401db97f
commit 14d50c4242
+7 -16
View File
@@ -831,7 +831,8 @@ updateGas w c
newVel@(V3 _ _ nvz) = (0.95 *^ springVels) + V3 0 0 (0.01 * vertVel)
newVel2 = stripZ newVel
vertVel = min 5 $ 20 - opz
springVels = foldl' (gasGasSpringVel c) (_gsVel c) (gassesNearPoint oldPos2 w)
springVels = c ^. gsPos
+ alaf Sum foldMap (radiusSpring 10 oldPos . _gsPos) (gassesNearPoint oldPos2 w)
oldPos@(V3 _ _ opz) = _gsPos c
oldPos2 = stripZ oldPos
newPos@(V3 _ _ npz) = oldPos + newVel
@@ -846,35 +847,25 @@ updateDust w c
| otherwise =
Just $
c
& dsPos .~ finalpos
& dsPos +~ newvel
& dsPos . _z %~ max 1
& dsVel .~ newvel
& dsTimer -~ 1
where
v@(V3 _ _ vz) = c ^. dsVel + sum (map (radiusSpring 10 oldPos . _dsPos)
(dssNearPoint oldPos2 w))
v@(V3 _ _ vz) = c ^. dsVel
+ alaf Sum foldMap (radiusSpring 10 oldPos . _dsPos) (dssNearPoint oldPos2 w)
newvel = 0.95 * (maybe v (addZ vz . snd) hitWl - V3 0 0 0.05)
oldPos = _dsPos c
oldPos2 = stripZ oldPos
newPos@(V3 _ _ npz) = oldPos + v
newPos = oldPos + v
newPos2 = stripZ newPos
hitWl = bouncePoint (const True) 1 oldPos2 newPos2 w
--finalpos = addZ (max 1 npz) $ maybe newPos2 fst hitWl
finalpos = oldPos + newvel & _z %~ max 1
radiusSpring :: Float -> Point3 -> Point3 -> Point3
radiusSpring r a b
| dist3 a b < r = 0.1 *^ normalizeV3 (a - b)
| otherwise = 0
gasGasSpringVel :: Gas -> Point3 -> Gas -> Point3
gasGasSpringVel a v b
| dist3 pa pb < radDist = v + 0.1 *^ normalizeV3 (pa - pb)
| otherwise = v
where
pa = _gsPos a
pb = _gsPos b
radDist = 10
simpleCrSprings :: World -> World
simpleCrSprings w =
IM.foldl' (flip crSpring) w $