Hand/handle position refactor

This commit is contained in:
2025-07-05 15:01:21 +01:00
parent 5ddfc83f09
commit 07c6298743
7 changed files with 34 additions and 24 deletions
+11 -5
View File
@@ -72,20 +72,20 @@ heldItemRelativeOrient itm cr (p, q)
sLen = _strideLength $ _crStance cr
handleOrient :: LocationLDT ItemLink OItem -> Point3Q
handleOrient _ = (V3 3 0 0, Q.qID)
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)
TwoHandUnder -> (V3 (-3) 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))
TwoHandUnder -> (V3 7 (-8) 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
@@ -112,8 +112,14 @@ aimStanceHandlePos _ it = case itemBaseStance it of
OneHand -> V2 10 (-2)
TwoHandFlat -> V2 10 0
heldItemOffset :: Item -> Creature -> Point3 -> Point3
heldItemOffset itm cr p = fst (heldItemRelativeOrient itm cr (p, Q.qID))
heldItemOffset :: LocationLDT ItemLink OItem -> Creature -> Point3 -> Point3
heldItemOffset loc cr p = x + Q.rotate q p
where
(x,q) = handOrient cr (aimStance (loc ^. locLDT))
`Q.comp` handleOrient loc
heldItemOffset' :: Item -> Creature -> Point3 -> Point3
heldItemOffset' itm cr p = fst (heldItemRelativeOrient itm cr (p, Q.qID))
shoulderHeight :: Float
shoulderHeight = 18