This commit is contained in:
2023-05-28 15:09:42 +01:00
parent 29017e6b06
commit 24939094c6
2 changed files with 25 additions and 10 deletions
+19 -8
View File
@@ -1,17 +1,33 @@
module Dodge.Creature.HandPos where
module Dodge.Creature.HandPos (
aimingWeaponZeroPos,
aimingMuzzlePos,
aimingMuzzleLength,
translatePointToLeftHand,
translatePointToRightHand,
translatePointToHead,
translateToLeftWrist,
translateToRightWrist,
translateToLeftLeg,
translateToRightLeg,
translateToHead,
translateToChest,
translateToBack,
translateToLeftHand,
translateToRightHand,
) where
import Linear
import Control.Lens
import Data.Maybe
import Dodge.Creature.Test
import Dodge.Data.Creature
import Geometry
import Linear
import ShapePicture
-- the position of a weapon handle
aimingWeaponHandlePos :: Creature -> Item -> Point2
aimingWeaponHandlePos _ it = case it ^? itUse . heldAim . aimStance of
Just TwoHandUnder -> 0
Just TwoHandUnder -> 0
Just TwoHandOver -> V2 (-7) 0
Just OneHand -> V2 10 (-2)
Just TwoHandFlat -> V2 10 0
@@ -27,11 +43,6 @@ aimingMuzzlePos cr it = fmap ((+ zp) . _mzPos) (it ^.. itUse . heldAim . aimMuzz
where
zp = aimingWeaponZeroPos cr it
aimingMuzzleOff :: Creature -> Item -> [Point2]
aimingMuzzleOff cr it = fmap (rotateV (_crDir cr) . (+ zp) . _mzPos) (it ^.. itUse . heldAim . aimMuzzles . folded)
where
zp = aimingWeaponZeroPos cr it
aimingMuzzleLength :: Creature -> Item -> Float
aimingMuzzleLength cr it = head (aimingMuzzlePos cr it) ^. _x
+6 -2
View File
@@ -1,4 +1,8 @@
module Dodge.Item.HeldOffset where
module Dodge.Item.HeldOffset (
turretItemOffset,
twoFlatHRot,
heldItemOffset,
) where
import Data.Maybe
import Dodge.Creature.HandPos
@@ -66,4 +70,4 @@ strideRot cr = case cr ^? crStance . carriage of
sLen = _strideLength $ _crStance cr
twoFlatHRot :: Creature -> Float
twoFlatHRot cr = 2 * strideRot cr
twoFlatHRot = (2 *) . strideRot