This commit is contained in:
2025-05-31 08:17:26 +01:00
parent cdf300b824
commit ceb7a4f04c
6 changed files with 99 additions and 133 deletions
+6 -7
View File
@@ -28,23 +28,23 @@ heldItemOrient2D itm cr p a = (V2 x y, argV . Q.qToV2 $ q )
where
(V3 x y _,q) = heldItemRelativeOrient itm cr (p `v2z` 0, Q.axisAngle (V3 0 0 1) a)
heldItemRelativeOrient :: Item -> Creature -> (Point3, Q.Quaternion Float) -> (Point3, Q.Quaternion Float)
heldItemRelativeOrient
:: Item -> Creature -> (Point3, Q.Quaternion Float) -> (Point3, Q.Quaternion Float)
heldItemRelativeOrient itm cr (p,q)
| Aiming {} <- _posture (_crStance cr) =
(p + aimingWeaponZeroPos cr itm `v2z` shoulderHeight, Q.qID * q)
| isTwoHandFlat =
( V3 (_crRad cr) 0 handD
+ rotate3 (twoFlatHRot cr) (transToHandle itm p)
( V3 (_crRad cr) 0 handD + rotate3 (twoFlatHRot cr) (transToHandle itm p)
, Q.axisAngle (V3 0 0 1) (twoFlatHRot cr) * q
)
| isOneHand =
( V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) handD
+ transToHandle itm p
+ transToHandle itm p
, Q.qID * q
)
| otherwise =
( V3 (_crRad cr) 0 handD
+ rotate3 (strideRot cr + 1.2) (V3 (-8) 0 0 + transToHandle itm p)
( V3 (_crRad cr) 0 handD
+ rotate3 (strideRot cr + 1.2) (V3 (-8) 0 0 + transToHandle itm p)
, Q.axisAngle (V3 0 0 1) (strideRot cr + 1.2) * q
)
where
@@ -74,7 +74,6 @@ aimingWeaponHandlePos _ it = case it ^? itUse . heldAim . aimStance of
Just TwoHandFlat -> V2 10 0
Nothing -> 0
heldItemOffset :: Item -> Creature -> Point3 -> Point3
heldItemOffset itm cr p = fst (heldItemRelativeOrient itm cr (p,Q.qID))