Tweak basic curvearound magnet

This commit is contained in:
2021-12-09 17:33:59 +00:00
parent 1a053421ef
commit e1a9327c06
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -14,9 +14,9 @@ curveLeftField mg pt = case pt of
BulletPt{} | dist (head $ _btTrail' pt) (_mgPos mg) < 500 -> pt & btVel' %~ rotateV 0.2
_ -> pt
curveAroundField :: Magnet -> Particle -> Particle
curveAroundField mg pt = case pt of
BulletPt{} | thedist < 200 -> pt & btVel' %~ rotateToCircle
curveAroundField :: Float -> Float -> Magnet -> Particle -> Particle
curveAroundField minrad maxrad mg pt = case pt of
BulletPt{} | thedist < maxrad -> pt & btVel' %~ rotateToCircle
where
thedist = dist btpos mgpos
mgpos = _mgPos mg
@@ -26,6 +26,6 @@ curveAroundField mg pt = case pt of
|| (isRHS mgpos btpos (btpos +.+ vel) && isLHS mgpos btpos (mgpos +.+ vNormal vel) )
= rotateV rot vel
| otherwise = rotateV (negate rot) vel
rot | thedist < 100 = 0.5
| otherwise = 0.5 - ((thedist - 100) / 200)
rot | thedist < minrad = 0.5
| otherwise = 0.5 * ((maxrad - thedist) / (maxrad - minrad) ) ** 2
_ -> pt