Partial implementation of more sensible muzzle position determination

This commit is contained in:
2024-11-28 21:15:22 +00:00
parent 0d5e578f07
commit 3763ff2c8a
6 changed files with 188 additions and 133 deletions
+6
View File
@@ -3,6 +3,7 @@ module Dodge.Item.HeldOffset (
twoFlatHRot,
heldItemOffset,
heldItemRelativeOrient,
heldItemOrient2D,
) where
import qualified Quaternion as Q
@@ -23,6 +24,11 @@ transToHandle itm = fromMaybe id $ do
V2 x y <- itm ^? itUse . heldAim . aimHandlePos
return (-.-.- V3 x y 0)
heldItemOrient2D :: Item -> Creature -> Point2 -> Float -> (Point2, Float)
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 itm cr (p,q)
| _posture (_crStance cr) == Aiming =