|
|
|
@@ -27,7 +27,7 @@ import qualified Quaternion as Q
|
|
|
|
|
import ShapePicture
|
|
|
|
|
|
|
|
|
|
translateToES :: Creature -> EquipSite -> Point3 -> Point3
|
|
|
|
|
translateToES cr es p = fst (equipSitePQ es cr `Q.comp` (p, Q.qID))
|
|
|
|
|
translateToES cr es p = fst (equipSitePQ es cr `Q.comp` (p, Q.qid))
|
|
|
|
|
|
|
|
|
|
equipSitePQ :: EquipSite -> Creature -> Point3Q
|
|
|
|
|
equipSitePQ = \case
|
|
|
|
@@ -40,7 +40,7 @@ equipSitePQ = \case
|
|
|
|
|
OnRightLeg -> legPQ RightForward
|
|
|
|
|
|
|
|
|
|
translatePointToRightHand :: Creature -> Point3 -> Point3
|
|
|
|
|
translatePointToRightHand cr p = fst (rightHandPQ cr `Q.comp` (p, Q.qID))
|
|
|
|
|
translatePointToRightHand cr p = fst (rightHandPQ cr `Q.comp` (p, Q.qid))
|
|
|
|
|
|
|
|
|
|
handWalkingPos :: FootForward -> Float -> Creature -> Point3
|
|
|
|
|
handWalkingPos b off cr = case cr ^. crStance . carriage of
|
|
|
|
@@ -65,15 +65,15 @@ zeroOneSmooth x = (1 - cos (pi * x)) / 2
|
|
|
|
|
|
|
|
|
|
rightHandPQ :: Creature -> Point3Q
|
|
|
|
|
rightHandPQ cr
|
|
|
|
|
| oneH cr = (V3 11 (-3) 20, Q.qID)
|
|
|
|
|
| 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 8 (-8) 12, Q.qID)
|
|
|
|
|
| twoFlat cr = (V3 8 (-8) 12, Q.qid)
|
|
|
|
|
| Just TwoHandTwist <- cr ^? crManipulation . manObject . imAimStance
|
|
|
|
|
= (V3 6 (-6) 10, Q.qID)
|
|
|
|
|
= (V3 6 (-6) 10, Q.qid)
|
|
|
|
|
| Just TwoHandFlat <- cr ^? crManipulation . manObject . imAimStance
|
|
|
|
|
= (V3 (8 - twoHandOffY cr) (-8) 12, Q.qID)
|
|
|
|
|
| Just p <- crRightHandWall cr = (20 & _xy .~ p, Q.qID)
|
|
|
|
|
| otherwise = (handWalkingPos LeftForward (-8) cr, Q.qID)
|
|
|
|
|
= (V3 (8 - twoHandOffY cr) (-8) 12, Q.qid)
|
|
|
|
|
| Just p <- crRightHandWall cr = (20 & _xy .~ p, Q.qid)
|
|
|
|
|
| otherwise = (handWalkingPos LeftForward (-8) cr, Q.qid)
|
|
|
|
|
|
|
|
|
|
crRightHandWall :: Creature -> Maybe Point2
|
|
|
|
|
crRightHandWall cr = do
|
|
|
|
@@ -115,19 +115,19 @@ translateToRightHand :: Creature -> SPic -> SPic
|
|
|
|
|
translateToRightHand = overPosSP . translatePointToRightHand
|
|
|
|
|
|
|
|
|
|
rightWristPQ :: Creature -> Point3Q
|
|
|
|
|
rightWristPQ cr = rightHandPQ cr `Q.comp` (V3 0 (-4) (-4), Q.qID)
|
|
|
|
|
rightWristPQ cr = rightHandPQ cr `Q.comp` (V3 0 (-4) (-4), Q.qid)
|
|
|
|
|
|
|
|
|
|
leftHandPQ :: Creature -> Point3Q
|
|
|
|
|
leftHandPQ cr
|
|
|
|
|
| twists cr = (V3 0 5 20, Q.qz (-1)) `Q.comp` (V3 12 4 0, Q.qz 0.4)
|
|
|
|
|
| twoFlat cr = (V3 8 8 12, Q.qID)
|
|
|
|
|
| twoFlat cr = (V3 8 8 12, Q.qid)
|
|
|
|
|
| Just TwoHandTwist <- cr ^? crManipulation . manObject . imAimStance
|
|
|
|
|
= (V3 (10 + twoHandOffY cr) 6 20, Q.qID)
|
|
|
|
|
= (V3 (10 + twoHandOffY cr) 6 20, Q.qid)
|
|
|
|
|
| Just TwoHandFlat <- cr ^? crManipulation . manObject . imAimStance
|
|
|
|
|
= (V3 (8 + twoHandOffY cr) 6 12, Q.qID)
|
|
|
|
|
| Just p <- crLeftHandWall cr = (20 & _xy .~ p, Q.qID)
|
|
|
|
|
= (V3 (8 + twoHandOffY cr) 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)
|
|
|
|
|
| otherwise = (handWalkingPos RightForward 8 cr, Q.qid)
|
|
|
|
|
|
|
|
|
|
twoHandOffY :: Creature -> Float
|
|
|
|
|
twoHandOffY cr = zeroOneSmooth $ case cr ^. crStance . carriage of
|
|
|
|
@@ -146,16 +146,16 @@ twoHandOffY cr = zeroOneSmooth $ case cr ^. crStance . carriage of
|
|
|
|
|
_ -> 0
|
|
|
|
|
|
|
|
|
|
translatePointToLeftHand :: Creature -> Point3 -> Point3
|
|
|
|
|
translatePointToLeftHand cr p = fst (leftHandPQ cr `Q.comp` (p, Q.qID))
|
|
|
|
|
translatePointToLeftHand cr p = fst (leftHandPQ cr `Q.comp` (p, Q.qid))
|
|
|
|
|
|
|
|
|
|
translateToLeftHand :: Creature -> SPic -> SPic
|
|
|
|
|
translateToLeftHand = overPosSP . translatePointToLeftHand
|
|
|
|
|
|
|
|
|
|
leftWristPQ :: Creature -> Point3Q
|
|
|
|
|
leftWristPQ cr = leftHandPQ cr `Q.comp` (V3 0 4 (-4), Q.qID)
|
|
|
|
|
leftWristPQ cr = leftHandPQ cr `Q.comp` (V3 0 4 (-4), Q.qid)
|
|
|
|
|
|
|
|
|
|
translateToLeftLeg :: Creature -> SPic -> SPic
|
|
|
|
|
translateToLeftLeg cr = overPosSP (\p -> fst (legPQ LeftForward cr `Q.comp` (p, Q.qID)))
|
|
|
|
|
translateToLeftLeg cr = overPosSP (\p -> fst (legPQ LeftForward cr `Q.comp` (p, Q.qid)))
|
|
|
|
|
|
|
|
|
|
legPQ :: FootForward -> Creature -> Point3Q
|
|
|
|
|
legPQ ff = case ff of
|
|
|
|
@@ -166,7 +166,7 @@ legPQ' :: (Float -> Float) -> Creature -> Point3Q
|
|
|
|
|
legPQ' g cr =
|
|
|
|
|
Q.comp
|
|
|
|
|
(0, Q.qz (_crMvDir cr - _crDir cr))
|
|
|
|
|
(V3 x (g off) 0, Q.qID)
|
|
|
|
|
(V3 x (g off) 0, Q.qid)
|
|
|
|
|
where
|
|
|
|
|
x = case cr ^? crStance . carriage of
|
|
|
|
|
Just (Walking sa LeftForward) -> -f sa
|
|
|
|
@@ -179,13 +179,13 @@ legPQ' g cr =
|
|
|
|
|
f i = g 8 * (sLen - i) / sLen
|
|
|
|
|
|
|
|
|
|
translateToRightLeg :: Creature -> SPic -> SPic
|
|
|
|
|
translateToRightLeg cr = overPosSP (\p -> fst (legPQ RightForward cr `Q.comp` (p, Q.qID)))
|
|
|
|
|
translateToRightLeg cr = overPosSP (\p -> fst (legPQ RightForward cr `Q.comp` (p, Q.qid)))
|
|
|
|
|
|
|
|
|
|
headPQ :: Creature -> Point3Q
|
|
|
|
|
headPQ cr
|
|
|
|
|
| twists cr = (V3 0 2 20, Q.qz (-1)) `Q.comp` (V3 (negate 2.5) 0.25 0, Q.qz 1)
|
|
|
|
|
| oneH cr = (V3 0 0 20, Q.qz 0.5) `Q.comp` (V3 2.5 0 0, Q.qz (-0.5))
|
|
|
|
|
| otherwise = (V3 2.5 0 20, Q.qID)
|
|
|
|
|
| otherwise = (V3 2.5 0 20, Q.qid)
|
|
|
|
|
|
|
|
|
|
chestPQ :: Creature -> Point3Q
|
|
|
|
|
chestPQ cr = backPQ cr `Q.comp` (0, Q.qz pi)
|
|
|
|
|