Simplify dust update
This commit is contained in:
+2
-2
@@ -852,14 +852,14 @@ updateDust w c
|
|||||||
where
|
where
|
||||||
v@(V3 _ _ vz) = c ^. dsVel + sum (map (radiusSpring 10 oldPos . _dsPos)
|
v@(V3 _ _ vz) = c ^. dsVel + sum (map (radiusSpring 10 oldPos . _dsPos)
|
||||||
(dssNearPoint oldPos2 w))
|
(dssNearPoint oldPos2 w))
|
||||||
-- foldl' (dustSpringVel c) (_dsVel c) (dssNearPoint oldPos2 w)
|
|
||||||
newvel = 0.95 * (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
|
||||||
newPos2 = stripZ newPos
|
newPos2 = stripZ newPos
|
||||||
hitWl = bouncePoint (const True) 1 oldPos2 newPos2 w
|
hitWl = bouncePoint (const True) 1 oldPos2 newPos2 w
|
||||||
finalpos = addZ (max 1 npz) $ maybe newPos2 fst hitWl
|
--finalpos = addZ (max 1 npz) $ maybe newPos2 fst hitWl
|
||||||
|
finalpos = oldPos + newvel & _z %~ max 1
|
||||||
|
|
||||||
radiusSpring :: Float -> Point3 -> Point3 -> Point3
|
radiusSpring :: Float -> Point3 -> Point3 -> Point3
|
||||||
radiusSpring r a b
|
radiusSpring r a b
|
||||||
|
|||||||
Reference in New Issue
Block a user