Tweak corpse/chasm interaction
This commit is contained in:
@@ -65,6 +65,7 @@ handWalkingPos b off cr = case cr ^. crStance . carriage of
|
|||||||
Floating -> V3 0 off 12
|
Floating -> V3 0 off 12
|
||||||
Flying {} -> V3 0 off 12
|
Flying {} -> V3 0 off 12
|
||||||
Boosting _ -> V3 0 off 12
|
Boosting _ -> V3 0 off 12
|
||||||
|
OnGround -> V3 0 off 12
|
||||||
|
|
||||||
zeroOneSmooth :: Float -> Float
|
zeroOneSmooth :: Float -> Float
|
||||||
zeroOneSmooth x = (1 - cos (pi * x)) / 2
|
zeroOneSmooth x = (1 - cos (pi * x)) / 2
|
||||||
|
|||||||
@@ -168,16 +168,30 @@ chasmTestCorpse cr w
|
|||||||
w
|
w
|
||||||
& tocr . crZVel -~ 0.5
|
& tocr . crZVel -~ 0.5
|
||||||
& tocr . crPos . _z +~ _crZVel cr
|
& tocr . crPos . _z +~ _crZVel cr
|
||||||
| Just (x, y) <- List.find g (w ^. cWorld . cliffs) =
|
-- only look for TWO cliffs to push along
|
||||||
|
| (xy:xys) <- filter g (w ^. cWorld . cliffs) =
|
||||||
w
|
w
|
||||||
& soundContinue (CrChasm (_crID cr)) (cr ^. crPos . _xy) debrisS (Just 100)
|
& soundContinue (CrChasm (_crID cr)) (cr ^. crPos . _xy) debrisS (Just 100)
|
||||||
& tocr . crPos . _xy +~ normalizeV (vNormal (x - y))
|
& tocr . crPos . _xy +~ h xy xys
|
||||||
| any f (w ^. cWorld . chasms) = w & tocr . crZVel -~ 0.5
|
| any f (w ^. cWorld . chasms) = w & tocr . crZVel -~ 0.5
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
where
|
where
|
||||||
|
|
||||||
|
h :: (Point2,Point2) -> [(Point2,Point2)] -> Point2
|
||||||
|
h (x,y) [] = normalizeV (vNormal (x-y))
|
||||||
|
h x (y:_) = unitVectorAtAngle $ tweenAngles (d1/(d1+d2)) (h' x) (h' y)
|
||||||
|
where
|
||||||
|
h' :: (Point2,Point2) -> Float
|
||||||
|
h' = argV . vNormal . uncurry (-)
|
||||||
|
d a = uncurry closestPointOnLine a (cr ^. crPos . _xy)
|
||||||
|
d1 :: Float
|
||||||
|
d1 = norm (cxy - d x)
|
||||||
|
d2 :: Float
|
||||||
|
d2 = norm (cxy - d y)
|
||||||
|
cxy = cr ^. crPos . _xy
|
||||||
tocr = cWorld . lWorld . creatures . ix (_crID cr)
|
tocr = cWorld . lWorld . creatures . ix (_crID cr)
|
||||||
g = uncurry $ circOnSeg (cr ^. crPos . _xy) (crRad $ cr ^. crType)
|
g = uncurry $ circOnSeg cxy (crRad $ cr ^. crType)
|
||||||
f = pointInPoly (cr ^. crPos . _xy)
|
f = pointInPoly cxy
|
||||||
|
|
||||||
chasmRotate :: Creature -> Point2 -> World -> World
|
chasmRotate :: Creature -> Point2 -> World -> World
|
||||||
chasmRotate cr v w
|
chasmRotate cr v w
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ data Carriage
|
|||||||
| Flying {_zSpeed :: Float, _flyInertia :: Float, _oldOldPos :: Point2}
|
| Flying {_zSpeed :: Float, _flyInertia :: Float, _oldOldPos :: Point2}
|
||||||
| Boosting Point2
|
| Boosting Point2
|
||||||
| Falling {_fallFlail :: Float, _fallFoot :: FootForward}
|
| Falling {_fallFlail :: Float, _fallFoot :: FootForward}
|
||||||
|
| OnGround
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data FootForward = LeftForward | RightForward
|
data FootForward = LeftForward | RightForward
|
||||||
|
|||||||
Reference in New Issue
Block a user