Test making walking movement slightly more floaty

This commit is contained in:
2026-04-03 19:52:56 +01:00
parent 2b2ac53466
commit 47ecfb7fd3
10 changed files with 35 additions and 45 deletions
+5 -2
View File
@@ -26,7 +26,8 @@ updateCarriage' cid cr w = \case
(chooseFootSound ff)
Nothing
& over (cWorld . lWorld . creatures . ix cid . crType) resetStride
_ -> w
& tocr . crPos +~ 0.1 *^ (cr ^. crOldPos - oop)
_ -> w & tocr . crPos +~ 0.5 *^ (cr ^. crOldPos - oop)
Floating -> w
Flying {_zSpeed = dz, _flyInertia = x} ->
w & cWorld . lWorld . creatures . ix cid . crPos . _xy +~ x *^ f (cr ^. crOldPos . _xy - oop ^. _xy)
@@ -38,11 +39,13 @@ updateCarriage' cid cr w = \case
let v = 0.9 *^ (cr ^. crOldPos - oop & _z -~ 0.5)
ep = cr ^. crPos + v
in if ep ^. _z < 0 && not (any (pointInPoly (ep ^. _xy)) (w ^. cWorld . chasms))
then w & cWorld . lWorld . creatures . ix cid . crPos .~ (ep & _z .~ 0)
then w & tocr . crPos .~ (ep & _z .~ 0)
& cWorld . lWorld . creatures . ix cid . crStance . carriage .~ OnGround
else w & cWorld . lWorld . creatures . ix cid . crPos .~ ep
OnGround {} -> w
& tocr . crPos +~ 0.8 *^ (cr ^. crOldPos - oop)
where
tocr = cWorld . lWorld . creatures . ix cid
oop = cr ^. crOldOldPos
f v | norm v > 10 = 10 *^ signorm v
| otherwise = v