Improve carriage/stride when falling down pit

This commit is contained in:
2026-03-27 00:33:19 +00:00
parent fed607681b
commit ac09ed6629
7 changed files with 119 additions and 109 deletions
+8
View File
@@ -45,6 +45,8 @@ rightHandPQ cr
| otherwise = case cr ^? crStance . carriage of
Just (Walking sa LeftForward) -> (V3 (- f sa) (- off) 10, Q.qID)
Just (Walking sa RightForward) -> (V3 (- g sa) (- off) 10, Q.qID)
Just (Falling sa LeftForward) -> (V3 (- f sa) (- off) 10, Q.qID)
Just (Falling sa RightForward) -> (V3 (- g sa) (- off) 10, Q.qID)
_ -> (V3 0 (- off) 10, Q.qID)
where
off = 8
@@ -66,6 +68,8 @@ leftHandPQ cr
| otherwise = case cr ^? crStance . carriage of
Just (Walking sa RightForward) -> (V3 (- f sa) off 10 , Q.qID)
Just (Walking sa LeftForward) -> (V3 (- g sa) off 10 , Q.qID)
Just (Falling sa RightForward) -> (V3 (- f sa) off 10 , Q.qID)
Just (Falling sa LeftForward) -> (V3 (- g sa) off 10 , Q.qID)
_ -> (V3 0 off 10, Q.qID)
where
off = 8
@@ -89,6 +93,8 @@ leftLegPQ cr = Q.comp (0,Q.qz (_crMvDir cr - _crDir cr))
x = case cr ^? crStance . carriage of
Just (Walking sa LeftForward) -> f sa
Just (Walking sa RightForward) -> - f sa
Just (Falling sa LeftForward) -> f sa
Just (Falling sa RightForward) -> - f sa
_ -> 0
off = 5
sLen = _strideLength $ _crStance cr
@@ -105,6 +111,8 @@ rightLegPQ cr = Q.comp (0,Q.qz (_crMvDir cr - _crDir cr))
x = case cr ^? crStance . carriage of
Just (Walking sa LeftForward) -> -f sa
Just (Walking sa RightForward) -> f sa
Just (Falling sa LeftForward) -> -f sa
Just (Falling sa RightForward) -> f sa
_ -> 0
off = -5
sLen = _strideLength $ _crStance cr
+8 -2
View File
@@ -136,7 +136,7 @@ dropAll cr w = foldl' (flip (dropItem cr)) w . reverse . IM.keys . _unNIntMap $
chasmTestLiving :: Creature -> World -> World
chasmTestLiving cr w
| _crZVel cr < 0 =
| Falling {} <- cr ^. crStance . carriage =
w
& tocr . crZVel -~ 0.5
& tocr . crPos . _z +~ _crZVel cr
@@ -145,13 +145,19 @@ chasmTestLiving cr w
& soundContinue (CrChasm (_crID cr)) (cr ^. crPos . _xy) debrisS (Just 100)
& tocr . crPos . _xy -~ normalizeV (vNormal (x - y))
& chasmRotate cr (x - y)
| any f (w ^. cWorld . chasms) = w & tocr . crZVel -~ 0.5
| any f (w ^. cWorld . chasms) = w & tocr %~ startFalling
| otherwise = w
where
tocr = cWorld . lWorld . creatures . ix (_crID cr)
g = uncurry $ circOnSeg (cr ^. crPos . _xy) (crRad $ cr ^. crType)
f = pointInPoly (cr ^. crPos . _xy)
startFalling :: Creature -> Creature
startFalling cr = case cr ^. crStance . carriage of
Walking a b -> cr & crZVel -~ 0.5
& crStance . carriage .~ Falling a b
_ -> cr
chasmTestCorpse :: Creature -> World -> World
chasmTestCorpse cr w
| _crZVel cr < 0 =