Simplify creature stride length
This commit is contained in:
@@ -31,12 +31,11 @@ chaseCrit =
|
||||
& crName .~ "chaseCrit"
|
||||
& crHP .~ HP 150
|
||||
& crFaction .~ ColorFaction green
|
||||
& crStance . strideLength .~ 30
|
||||
|
||||
hoverCrit :: Creature
|
||||
hoverCrit =
|
||||
defaultCreature
|
||||
& crName .~ "chaseCrit"
|
||||
& crHP .~ HP 150
|
||||
& crFaction .~ ColorFaction green
|
||||
& crStance . strideLength .~ 30
|
||||
& crName .~ "hoverCrit"
|
||||
& crHP .~ HP 100
|
||||
& crFaction .~ ColorFaction blue
|
||||
& crStance . carriage .~ Flying
|
||||
|
||||
@@ -13,6 +13,7 @@ module Dodge.Creature.HandPos (
|
||||
translateToES,
|
||||
rightHandPQ,
|
||||
leftHandPQ,
|
||||
strideLength,
|
||||
) where
|
||||
|
||||
import Control.Monad
|
||||
@@ -42,16 +43,21 @@ equipSitePQ = \case
|
||||
translatePointToRightHand :: Creature -> Point3 -> Point3
|
||||
translatePointToRightHand cr p = fst (rightHandPQ cr `Q.comp` (p, Q.qid))
|
||||
|
||||
strideLength :: Creature -> Float
|
||||
strideLength cr = case cr ^. crType of
|
||||
Avatar{} -> 35
|
||||
_ -> 30
|
||||
|
||||
handWalkingPos :: FootForward -> Float -> Creature -> Point3
|
||||
handWalkingPos b off cr = case cr ^. crStance . carriage of
|
||||
Walking sa ff ->
|
||||
let slen = cr ^. crStance . strideLength
|
||||
let slen = strideLength cr
|
||||
f i
|
||||
| ff == b = 8 * zeroOneSmooth ((slen - i) / slen)
|
||||
| otherwise = 8 * zeroOneSmooth (i / slen)
|
||||
in V3 (f sa) off 12
|
||||
Falling sa ff ->
|
||||
let slen = cr ^. crStance . strideLength
|
||||
let slen = strideLength cr
|
||||
f i
|
||||
| ff == b = 8 * zeroOneSmooth ((slen - i) / slen)
|
||||
| otherwise = 8 * zeroOneSmooth (i / slen)
|
||||
@@ -132,13 +138,13 @@ leftHandPQ cr
|
||||
twoHandOffY :: Creature -> Float
|
||||
twoHandOffY cr = zeroOneSmooth $ case cr ^. crStance . carriage of
|
||||
Walking sa ff ->
|
||||
let slen = cr ^. crStance . strideLength
|
||||
let slen = strideLength cr
|
||||
f i
|
||||
| ff == RightForward = (slen - i) / slen
|
||||
| otherwise = i / slen
|
||||
in f sa
|
||||
Falling sa ff ->
|
||||
let slen = cr ^. crStance . strideLength
|
||||
let slen = strideLength cr
|
||||
f i
|
||||
| ff == RightForward = (slen - i) / slen
|
||||
| otherwise = i / slen
|
||||
@@ -175,7 +181,7 @@ legPQ' g cr =
|
||||
Just (Falling sa RightForward) -> f sa
|
||||
_ -> 0
|
||||
off = -5
|
||||
sLen = _strideLength $ _crStance cr
|
||||
sLen = strideLength cr
|
||||
f i = g 8 * (sLen - i) / sLen
|
||||
|
||||
translateToRightLeg :: Creature -> SPic -> SPic
|
||||
|
||||
@@ -78,7 +78,7 @@ chaseUpperBody cr = colorSH (_skinUpper cskin)
|
||||
vocaltilt = case cr ^? crVocalization . vcTime of
|
||||
Just x | x < 20 -> -pi * 0.05 * (10 - abs (fromIntegral x - 10))
|
||||
_ -> 0
|
||||
sLen = _strideLength $ _crStance cr
|
||||
sLen = strideLength cr
|
||||
tbob = 5 * (1 - oneSmooth (abs llegpos))
|
||||
llegpos = case cr ^? crStance . carriage of
|
||||
Just (Walking sa LeftForward) -> f sa
|
||||
@@ -101,7 +101,7 @@ feet cr = case cr ^? crStance . carriage of
|
||||
sh x = translateSHxy x off aFoot <> translateSHxy (- x) (- off) aFoot
|
||||
aFoot = upperPrismPolyST 10 $ polyCirc 3 4
|
||||
off = 5
|
||||
sLen = _strideLength $ _crStance cr
|
||||
sLen = strideLength cr
|
||||
-- f i = 8 * (sLen - 2*i) / sLen
|
||||
f i = 8 * oneSmooth ((sLen - 2*i) / sLen)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
module Dodge.Creature.State.WalkCycle (updateWalkCycle) where
|
||||
|
||||
import Dodge.Creature.HandPos
|
||||
import Linear
|
||||
import Control.Lens
|
||||
import Dodge.Data.World
|
||||
@@ -12,7 +13,7 @@ updateWalkCycle :: Int -> World -> World
|
||||
updateWalkCycle cid w
|
||||
| Just cr <- w ^? cWorld . lWorld . creatures . ix cid
|
||||
, Walking x ff <- cr ^. crStance . carriage
|
||||
, x >= cr ^. crStance . strideLength =
|
||||
, x >= strideLength cr =
|
||||
w
|
||||
& soundMultiFrom
|
||||
[FootstepSound i | i <- [0 .. 10]]
|
||||
|
||||
@@ -15,7 +15,6 @@ import Geometry.Data
|
||||
data Stance = Stance
|
||||
{ _carriage :: Carriage
|
||||
, _posture :: Posture
|
||||
, _strideLength :: Float
|
||||
}
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ defaultCreature =
|
||||
Stance
|
||||
{ _carriage = Walking 0 LeftForward
|
||||
, _posture = AtEase
|
||||
, _strideLength = yourDefaultStrideLength
|
||||
}
|
||||
, _crVocalization = VocReady
|
||||
, _crActionPlan = ActionPlan [] (StrategyActions WatchAndWait [StartSentinelPost]) [LiveLongAndProsper]
|
||||
|
||||
@@ -7,8 +7,8 @@ module Dodge.Item.HeldOffset (
|
||||
handHandleOrient,
|
||||
) where
|
||||
|
||||
import Linear
|
||||
import Dodge.Creature.HandPos
|
||||
import Linear
|
||||
import Dodge.Data.AimStance
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Data.Creature
|
||||
@@ -86,7 +86,7 @@ strideRot cr = case cr ^? crStance . carriage of
|
||||
_ -> 0
|
||||
where
|
||||
f i = 0.1 * (sLen - i) / sLen
|
||||
sLen = _strideLength $ _crStance cr
|
||||
sLen = strideLength cr
|
||||
|
||||
twoFlatHRot :: Creature -> Float
|
||||
twoFlatHRot = (2 *) . strideRot
|
||||
|
||||
Reference in New Issue
Block a user