Tweak basic curvearound magnet
This commit is contained in:
@@ -33,7 +33,7 @@ useMagShield cr invid w = w & magnets . at mgid ?~ themagnet
|
|||||||
{_mgID = mgid
|
{_mgID = mgid
|
||||||
,_mgUpdate = Just . (mgUpdate .~ const Nothing)
|
,_mgUpdate = Just . (mgUpdate .~ const Nothing)
|
||||||
,_mgPos = _crPos cr
|
,_mgPos = _crPos cr
|
||||||
,_mgField = curveAroundField
|
,_mgField = curveAroundField 50 200
|
||||||
}
|
}
|
||||||
mgid = case it ^? itAttachment . itMInt . _Just of
|
mgid = case it ^? itAttachment . itMInt . _Just of
|
||||||
Just mgid' -> mgid'
|
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
|
BulletPt{} | dist (head $ _btTrail' pt) (_mgPos mg) < 500 -> pt & btVel' %~ rotateV 0.2
|
||||||
_ -> pt
|
_ -> pt
|
||||||
|
|
||||||
curveAroundField :: Magnet -> Particle -> Particle
|
curveAroundField :: Float -> Float -> Magnet -> Particle -> Particle
|
||||||
curveAroundField mg pt = case pt of
|
curveAroundField minrad maxrad mg pt = case pt of
|
||||||
BulletPt{} | thedist < 200 -> pt & btVel' %~ rotateToCircle
|
BulletPt{} | thedist < maxrad -> pt & btVel' %~ rotateToCircle
|
||||||
where
|
where
|
||||||
thedist = dist btpos mgpos
|
thedist = dist btpos mgpos
|
||||||
mgpos = _mgPos mg
|
mgpos = _mgPos mg
|
||||||
@@ -26,6 +26,6 @@ curveAroundField mg pt = case pt of
|
|||||||
|| (isRHS mgpos btpos (btpos +.+ vel) && isLHS mgpos btpos (mgpos +.+ vNormal vel) )
|
|| (isRHS mgpos btpos (btpos +.+ vel) && isLHS mgpos btpos (mgpos +.+ vNormal vel) )
|
||||||
= rotateV rot vel
|
= rotateV rot vel
|
||||||
| otherwise = rotateV (negate rot) vel
|
| otherwise = rotateV (negate rot) vel
|
||||||
rot | thedist < 100 = 0.5
|
rot | thedist < minrad = 0.5
|
||||||
| otherwise = 0.5 - ((thedist - 100) / 200)
|
| otherwise = 0.5 * ((maxrad - thedist) / (maxrad - minrad) ) ** 2
|
||||||
_ -> pt
|
_ -> pt
|
||||||
|
|||||||
Reference in New Issue
Block a user