Magnets
This commit is contained in:
@@ -8,3 +8,22 @@ dampField :: Magnet -> Particle -> Particle
|
||||
dampField mg pt = case pt of
|
||||
BulletPt{} | dist (head $ _btTrail' pt) (_mgPos mg) < 100 -> pt & btVel' *~ 0.5
|
||||
_ -> pt
|
||||
|
||||
curveLeftField :: Magnet -> Particle -> Particle
|
||||
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{} | dist btpos mgpos < 500 -> pt & btVel' %~ rotateToCircle
|
||||
where
|
||||
mgpos = _mgPos mg
|
||||
btpos = head $ _btTrail' 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) )
|
||||
= rotateV rot vel
|
||||
| otherwise = rotateV (negate rot) vel
|
||||
rot = 0.5
|
||||
_ -> pt
|
||||
|
||||
Reference in New Issue
Block a user