Tweak basic curvearound magnet
This commit is contained in:
@@ -33,7 +33,7 @@ useMagShield cr invid w = w & magnets . at mgid ?~ themagnet
|
||||
{_mgID = mgid
|
||||
,_mgUpdate = Just . (mgUpdate .~ const Nothing)
|
||||
,_mgPos = _crPos cr
|
||||
,_mgField = curveAroundField
|
||||
,_mgField = curveAroundField 50 200
|
||||
}
|
||||
mgid = case it ^? itAttachment . itMInt . _Just of
|
||||
Just mgid' -> mgid'
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user