Start refactoring hand/item handle orientation

This commit is contained in:
2025-07-05 11:50:25 +01:00
parent d8e811c050
commit 5ddfc83f09
4 changed files with 108 additions and 79 deletions
+23
View File
@@ -71,6 +71,29 @@ heldItemRelativeOrient itm cr (p, q)
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
sLen = _strideLength $ _crStance cr
handleOrient :: LocationLDT ItemLink OItem -> Point3Q
handleOrient _ = (V3 3 0 0, Q.qID)
-- note this is relative to the creature
handOrient :: Creature -> AimStance -> Point3Q
handOrient cr = case cr ^. crStance . posture of
Aiming -> \case
TwoHandUnder -> (V3 1 0 shoulderHeight, Q.qID)
TwoHandOver -> (V3 0 0 shoulderHeight, Q.qID)
OneHand -> (V3 13 (-2) shoulderHeight, Q.qID)
TwoHandFlat -> (V3 13 0 shoulderHeight, Q.qID)
AtEase -> \case
OneHand -> (V3 (10 + walkhandp) (-7) 15, Q.qID)
TwoHandFlat -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) $ twoFlatHRot cr)
TwoHandUnder -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2))
TwoHandOver -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2))
where
walkhandp = case cr ^? crStance . carriage of
Just (Walking x LeftForward) -> f x * 50 -2
_ -> - 2
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
sLen = _strideLength $ _crStance cr
locOrientation :: LocationLDT ItemLink OItem -> Creature -> Point3Q
locOrientation loc cr =
heldItemRelativeOrient
+3 -3
View File
@@ -242,9 +242,9 @@ heldPositionInfo = aimStanceInfo . itemBaseStance
aimStanceInfo :: AimStance -> String
aimStanceInfo as = case as of
TwoHandUnder -> "It is held in two hands and tucked under the shoulder."
TwoHandOver -> "It is held in two hands and over the shoulder."
TwoHandFlat -> "It is held in two hands at its sides."
TwoHandUnder -> "It is held using two hands, tucked under the shoulder."
TwoHandOver -> "It is held using two hands, resting over the shoulder."
TwoHandFlat -> "It is held using two hands in front of the body."
OneHand -> "It is held in one hand."
itmEquipSiteInfo :: Item -> String