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