diff --git a/src/Dodge/Creature/HandPos.hs b/src/Dodge/Creature/HandPos.hs index 14ce9045b..1dcc12175 100644 --- a/src/Dodge/Creature/HandPos.hs +++ b/src/Dodge/Creature/HandPos.hs @@ -47,26 +47,31 @@ handWalkingPos b off cr = case cr ^. crStance . carriage of Walking sa ff -> let slen = cr ^. crStance . strideLength f i - | ff == b = 8 * (slen - i) / slen - | otherwise = 8 * i / slen + | 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 f i - | ff == b = 8 * (slen - i) / slen - | otherwise = 8 * i / slen + | ff == b = 8 * zeroOneSmooth ((slen - i) / slen) + | otherwise = 8 * zeroOneSmooth (i / slen) in V3 (f sa) off 20 Floating -> V3 0 off 12 Flying -> V3 0 off 12 Boosting _ -> V3 0 off 12 +zeroOneSmooth :: Float -> Float +zeroOneSmooth x = (1 - cos (pi * x)) / 2 + rightHandPQ :: Creature -> Point3Q rightHandPQ cr | oneH cr = (V3 11 (-3) 20, Q.qID) | twists cr = (V3 0 5 20, Q.qz (-1)) `Q.comp` (V3 4 (-10) 0, Q.qz 1) | twoFlat cr = (V3 4 (-8) 12, Q.qID) | Just TwoHandTwist <- cr ^? crManipulation . manObject . imAimStance - = (V3 8 (-6) 10, Q.qID) + = (V3 6 (-6) 10, Q.qID) + | Just TwoHandFlat <- cr ^? crManipulation . manObject . imAimStance + = (V3 8 (-8) 12, Q.qID) | Just p <- crRightHandWall cr = (20 & _xy .~ p, Q.qID) | otherwise = (handWalkingPos LeftForward (-8) cr, Q.qID) @@ -117,13 +122,29 @@ leftHandPQ cr | twists cr = (V3 0 5 20, Q.qz (-1)) `Q.comp` (V3 12 4 0, Q.qz 0.4) | twoFlat cr = (V3 4 8 12, Q.qID) | Just TwoHandTwist <- cr ^? crManipulation . manObject . imAimStance - = (V3 10 8 20, Q.qID) + = (V3 (10 + 1*twoHandOffY cr) 6 20, Q.qID) | Just TwoHandFlat <- cr ^? crManipulation . manObject . imAimStance - = (V3 10 8 20, Q.qID) + = (V3 8 6 12, Q.qID) | Just p <- crLeftHandWall cr = (20 & _xy .~ p, Q.qID) | oneH cr = (V3 0 8 10, Q.qz 0.4) | otherwise = (handWalkingPos RightForward 8 cr, Q.qID) +twoHandOffY :: Creature -> Float +twoHandOffY cr = zeroOneSmooth $ case cr ^. crStance . carriage of + Walking sa ff -> + let slen = cr ^. crStance . strideLength + f i + | ff == RightForward = (slen - i) / slen + | otherwise = i / slen + in f sa + Falling sa ff -> + let slen = cr ^. crStance . strideLength + f i + | ff == RightForward = (slen - i) / slen + | otherwise = i / slen + in f sa + _ -> 0 + translatePointToLeftHand :: Creature -> Point3 -> Point3 translatePointToLeftHand cr p = fst (leftHandPQ cr `Q.comp` (p, Q.qID))