Improve debris

This commit is contained in:
2022-06-16 12:24:09 +01:00
parent fa762c7687
commit aa29e5ddf2
14 changed files with 75 additions and 50 deletions
+19
View File
@@ -37,6 +37,25 @@ makeDebris bm p w = w
& pjVelZ .~ 0
& pjPosZ .~ h
makeDebrisDirected :: BlockMaterial -> Point2 -> Float -> World -> World
makeDebrisDirected bm p dir w = w
& flip (foldr (plNew props pjID)) thedebris
& randGen .~ newg
& matDesSound bm p
where
(thedebris,newg) = runState (mapM f [35,55..95]) $ _randGen w
f h = do
v <- rotateV (dir - pi/4) <$> randInArcStrip 2 3 (pi/2)
q <- Q.vToQuat (V3 0 0 1) <$> randOnUnitSphere
return $ someDebris
& prPos .~ p
& pjColor .~ greyN 0.5
& pjVel .~ v
& pjQuatSpin .~ Q.axisAngle (vNormal v `v2z` 0) (-0.1)
& pjQuat .~ q
& pjVelZ .~ 0
& pjPosZ .~ h
someDebris :: Prop
someDebris = PropZ
{_prPos = 0