Make weapon position relative to hand positions, wonky for now

This commit is contained in:
2026-03-30 21:10:20 +01:00
parent d00b4d1c6f
commit 633bf479b2
3 changed files with 32 additions and 15 deletions
+2 -1
View File
@@ -12,6 +12,7 @@ module Dodge.Creature.HandPos (
headPQ,
translateToES,
rightHandPQ,
leftHandPQ,
) where
import Control.Monad
@@ -62,7 +63,7 @@ handWalkingPos b off cr = case cr ^. crStance . carriage of
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.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 p <- crRightHandWall cr = (20 & _xy .~ p, Q.qID)
| otherwise = (handWalkingPos LeftForward (-8) cr, Q.qID)
+29 -12
View File
@@ -34,20 +34,37 @@ handleOrient loc = case loc ^. locDT . dtValue . _1 . itType of
HELD FLAMETHROWER -> (V3 (-1) 0 0, Q.qID)
_ -> (V3 (-3) 0 0, Q.qID)
-- note this is relative to the creature
-- the aimstance here should match any aimstance in Aiming
---- note this is relative to the creature
---- the aimstance here should match any aimstance in Aiming
--handOrient :: Creature -> AimStance -> Point3Q
--handOrient cr = case cr ^. crStance . posture of
-- Aiming {} -> \case
-- 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 -> rightHandPQ cr
-- TwoHandFlat -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) $ twoFlatHRot cr)
-- 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))
handOrient :: Creature -> AimStance -> Point3Q
handOrient cr = case cr ^. crStance . posture of
Aiming {} -> \case
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
handOrient cr = \case
TwoHandUnder ->
let (rp,_) = rightHandPQ cr
(lp,_) = leftHandPQ cr
in (rp,Q.qz (argV $ (lp - rp) ^. _xy))
TwoHandOver ->
let (rp,_) = rightHandPQ cr
(lp,_) = leftHandPQ cr
in (rp,Q.qz (argV $ (lp - rp) ^. _xy))
OneHand -> rightHandPQ cr
TwoHandFlat -> (V3 10 0 15, Q.axisAngle (V3 0 0 1) $ twoFlatHRot cr)
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))
TwoHandFlat ->
let (rp,_) = rightHandPQ cr
(lp,_) = leftHandPQ cr
in (0.5 *^ (rp + lp),Q.qz (argV (vNormal ((lp - rp) ^. _xy))))
locOrient :: LocationDT OItem -> Creature -> Point3Q
locOrient loc cr =
-1
View File
@@ -351,7 +351,6 @@ muzzleWallCheck w cr = fromMaybe cr $ do
^? ix invid . _2
let ps = reduceLocDT f loc ^.. each . _1 . _xy
cp = cr ^. crPos . _xy
-- cop = cr ^. crOldPos . _xy
r <- boundPointsRect (cp : ps)
let wls = uncurry wlsNearRect r w & IM.elems & filter (not . _wlTouchThrough)
vs = mapMaybe (g cp wls) ps