Improve chaseCrit shape
This commit is contained in:
@@ -28,6 +28,7 @@ defaultChaseMvType =
|
||||
CrMvType
|
||||
{ _mvSpeed = 2
|
||||
, _mvTurnRad = FloatAbsCheckGreaterLess (pi / 4) 0.2 0.05
|
||||
--, _mvTurnJit = 0.3
|
||||
, _mvTurnJit = 0.05
|
||||
, _mvAimSpeed = FloatAbsCheckGreaterLess (pi / 8) 0.2 0.01
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ chaseUpperBody w cr = colorSH (_skinUpper cskin)
|
||||
cskin = crShape $ _crType cr
|
||||
torsoq = (V3 0 0 (10 + tz + tbob),Q.qid)
|
||||
mcool = 1 - min 10 (fromIntegral . _meleeCooldown $ _crType cr) / 10
|
||||
neckq = torsoq `Q.comp` (V3 6 0 0,Q.axisAngle (V3 0 1 0) (-1.8*mcool))
|
||||
headq = neckq `Q.comp` (V3 16 0 0, Q.axisAngle (V3 0 1 0) (2*mcool+vocaltilt) * Q.qz headrot )
|
||||
neckq = torsoq `Q.comp` (V3 6 0 0, Q.qz aimrot * Q.axisAngle (V3 0 1 0) (-1.8*mcool))
|
||||
headq = neckq `Q.comp` (V3 16 0 0, Q.axisAngle (V3 0 1 0) (2*mcool+vocaltilt) * Q.qz aimrot )
|
||||
vocaltilt = case cr ^? crVocalization . vcTime of
|
||||
Just x | x < 20 -> -pi * 0.05 * (10 - abs (fromIntegral x - 10))
|
||||
_ -> 0
|
||||
@@ -103,6 +103,11 @@ chaseUpperBody w cr = colorSH (_skinUpper cskin)
|
||||
--tbob = 2 * oneSmooth ((sLen - 2*i) / sLen)
|
||||
f i = (sLen - 2*i) / sLen
|
||||
cxy = cr ^. crPos . _xy
|
||||
aimrot = fromMaybe pi $ do
|
||||
i <- cr ^. crIntention . targetCr
|
||||
tcxy <- w ^? cWorld . lWorld . creatures . ix i . crPos . _xy
|
||||
guard $ hasLOSIndirect cxy tcxy w
|
||||
return . (0.5*) . nearZeroAngle $ argV (tcxy - cxy) - cr ^. crDir
|
||||
headrot = fromMaybe pi $ do
|
||||
i <- cr ^. crIntention . targetCr
|
||||
tcxy <- w ^? cWorld . lWorld . creatures . ix i . crPos . _xy
|
||||
|
||||
@@ -117,19 +117,14 @@ wasdWithAiming w cr = wasdAim inp w $ wasdMovement (w ^. cWorld . lWorld) inp ca
|
||||
wasdAim :: Input -> World -> Creature -> Creature
|
||||
wasdAim inp w cr
|
||||
| SDL.ButtonRight `M.member` _mouseButtons inp
|
||||
, AtEase <- cr ^. crStance . posture = setposture Aiming (-twoHandTwistAmount)
|
||||
-- cr
|
||||
-- & crStance . posture .~ Aiming
|
||||
-- & doAimTwist (cr ^? crManipulation . manObject . imAimStance) (-twoHandTwistAmount)
|
||||
| SDL.ButtonRight `M.member` _mouseButtons inp =
|
||||
aimTurn (w ^. cWorld . lWorld) mousedir cr
|
||||
, AtEase <- cr ^. crStance . posture =
|
||||
setposture Aiming (-twoHandTwistAmount)
|
||||
| SDL.ButtonRight `M.member` _mouseButtons inp = aimTurn (w ^. cWorld . lWorld) mousedir cr
|
||||
| Aiming{} <- cr ^. crStance . posture = setposture AtEase twoHandTwistAmount
|
||||
-- cr
|
||||
-- & crStance . posture .~ AtEase
|
||||
-- & doAimTwist (cr ^? crManipulation . manObject . imAimStance) twoHandTwistAmount
|
||||
| otherwise = creatureTurnTowardDir (_crMvAim cr) 0.2 cr
|
||||
where
|
||||
setposture x r = cr
|
||||
setposture x r =
|
||||
cr
|
||||
& crStance . posture .~ x
|
||||
& doAimTwist (cr ^? crManipulation . manObject . imAimStance) r
|
||||
mousedir = argV $ w ^. cWorld . lWorld . lAimPos - (cr ^. crPos . _xy)
|
||||
|
||||
Reference in New Issue
Block a user