This commit is contained in:
2021-12-15 22:21:58 +00:00
parent 9dadea2c36
commit 9ead5b3979
11 changed files with 130 additions and 174 deletions
+3 -3
View File
@@ -6,12 +6,12 @@ import Control.Lens
dampField :: Magnet -> Particle -> Particle
dampField mg pt = case pt of
BulletPt{} | dist (head $ _btTrail' pt) (_mgPos mg) < 100 -> pt & ptVel *~ 0.5
BulletPt{} | dist (head $ _ptTrail pt) (_mgPos mg) < 100 -> pt & ptVel *~ 0.5
_ -> pt
curveLeftField :: Magnet -> Particle -> Particle
curveLeftField mg pt = case pt of
BulletPt{} | dist (head $ _btTrail' pt) (_mgPos mg) < 500 -> pt & ptVel %~ rotateV 0.2
BulletPt{} | dist (head $ _ptTrail pt) (_mgPos mg) < 500 -> pt & ptVel %~ rotateV 0.2
_ -> pt
curveAroundField :: Float -> Float -> Magnet -> Particle -> Particle
@@ -20,7 +20,7 @@ curveAroundField minrad maxrad mg pt = case pt of
where
thedist = dist btpos mgpos
mgpos = _mgPos mg
btpos = head $ _btTrail' pt
btpos = head $ _ptTrail pt
rotateToCircle vel
| (isLHS mgpos btpos (btpos +.+ vel) && isRHS mgpos btpos (mgpos +.+ vNormal vel) )
|| (isRHS mgpos btpos (btpos +.+ vel) && isLHS mgpos btpos (mgpos +.+ vNormal vel) )