Work on AttachUse -> UseAttach
This commit is contained in:
@@ -4,6 +4,7 @@ module Dodge.Item.HeldOffset (
|
||||
heldItemOffset,
|
||||
) where
|
||||
|
||||
import qualified Linear.Quaternion as Q
|
||||
import Data.Maybe
|
||||
import Dodge.Creature.HandPos
|
||||
import Dodge.Data.Creature
|
||||
@@ -21,6 +22,37 @@ transToHandle itm = fromMaybe id $ do
|
||||
V2 x y <- itm ^? itUse . heldAim . aimHandlePos
|
||||
return (-.-.- V3 x y 0)
|
||||
|
||||
heldItemRelativeOrient :: Item -> Creature -> (Point3, Q.Quaternion Float) -> (Point3, Q.Quaternion Float)
|
||||
heldItemRelativeOrient itm cr (p,q)
|
||||
| _posture (_crStance cr) == Aiming = (p,q)
|
||||
| isTwoHandFlat = (p,q)
|
||||
-- (+.+.+ V3 (_crRad cr) 0 handD)
|
||||
-- . rotate3 (twoFlatHRot cr)
|
||||
-- . transToHandle itm
|
||||
| isOneHand = (p,q)
|
||||
-- (+.+.+ V3 0 0 handD)
|
||||
-- . (+.+.+ V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) 0)
|
||||
-- . (+.+.+ V3 (-2) 0 0)
|
||||
-- . transToHandle itm
|
||||
| otherwise = (p,q)
|
||||
-- (+.+.+ V3 0 0 handD)
|
||||
-- . (+.+.+ V3 (_crRad cr) 0 0)
|
||||
-- . rotate3 (strideRot cr + 1.2)
|
||||
-- . (+.+.+ V3 (-8) 0 0)
|
||||
-- . transToHandle itm
|
||||
where
|
||||
handD = 15
|
||||
handPos = case cr ^? crStance . carriage of
|
||||
Just (Walking x LeftForward) -> f x * 50
|
||||
_ -> 0
|
||||
isOneHand =
|
||||
itm ^? itUseAimStance == Just OneHand
|
||||
|| isNothing (itm ^? itUseAimStance)
|
||||
isTwoHandFlat = itm ^? itUseAimStance == Just TwoHandFlat
|
||||
itUseAimStance = itUse . heldAim . aimStance
|
||||
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
|
||||
sLen = _strideLength $ _crStance cr
|
||||
|
||||
heldItemOffset :: Item -> Creature -> Point3 -> Point3
|
||||
heldItemOffset itm cr
|
||||
| _posture (_crStance cr) == Aiming =
|
||||
@@ -39,7 +71,6 @@ heldItemOffset itm cr
|
||||
. (+.+.+ V3 (_crRad cr) 0 0)
|
||||
. rotate3 (strideRot cr + 1.2)
|
||||
. (+.+.+ V3 (-8) 0 0)
|
||||
-- . (+.+.+ V3 (-5) 0 0)
|
||||
. transToHandle itm
|
||||
where
|
||||
handD = 15
|
||||
|
||||
Reference in New Issue
Block a user