Tweak dust
This commit is contained in:
+5
-7
@@ -616,7 +616,7 @@ updateClouds :: World -> World
|
||||
updateClouds = updateObjCatMaybes clouds updateCloud
|
||||
|
||||
updateDusts :: World -> World
|
||||
updateDusts = updateObjCatMaybes dusts updateDust
|
||||
updateDusts w = updateObjMapMaybe dusts (updateDust w) w
|
||||
|
||||
--updateBeams :: World -> World
|
||||
--updateBeams w =
|
||||
@@ -764,21 +764,19 @@ updateCloud w c
|
||||
finalPos = addZ (max 1 $ min 90 npz) $ maybe newPos2 fst hitWl
|
||||
finalVel = addZ nvz $ maybe newVel2 snd hitWl
|
||||
|
||||
updateDust :: World -> Dust -> (World, Maybe Dust)
|
||||
updateDust :: World -> Dust -> Maybe Dust
|
||||
updateDust w c
|
||||
| _dsTimer c < 1 = (w, Nothing)
|
||||
| _dsTimer c < 1 = Nothing
|
||||
| otherwise =
|
||||
( w
|
||||
, Just $
|
||||
Just $
|
||||
c
|
||||
& dsPos .~ finalpos
|
||||
& dsVel .~ newvel
|
||||
& dsTimer -~ 1
|
||||
)
|
||||
where
|
||||
springvel = foldl' (dustSpringVel c) (_dsVel c) (dssNearPoint oldPos2 w)
|
||||
v@(V3 _ _ vz) = springvel
|
||||
newvel = 0.9 * (maybe v (addZ vz . snd) hitWl - V3 0 0 0.05)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user