Work on crab crit

This commit is contained in:
2026-04-10 09:07:04 +01:00
parent ea6f4b2054
commit 8faaf54f2c
3 changed files with 66 additions and 39 deletions
+19 -2
View File
@@ -17,6 +17,7 @@ makeCorpse :: StdGen -> Creature -> SPic
makeCorpse g cr = case cr ^. crType of
HoverCrit{} -> noPic $ drawHoverCrit cr
ChaseCrit{} -> noPic $ chaseCorpse g cr
CrabCrit{} -> noPic $ crabCorpse g cr
_ ->
noPic
. scaleSH (V3 crsize crsize crsize)
@@ -43,8 +44,24 @@ chaseCorpse g cr = mconcat
]
where
neckq = (V3 6 0 0, Q.qz a)
a = fst $ randomR (-2,2) g
b = fst $ randomR (-2,2) g
(a,g') = randomR (-2,2) g
b = fst $ randomR (-2,2) g'
cskin = crShape $ _crType cr -- this should be fixed
rotmdir = rotateSH (_crMvDir cr - _crDir cr)
headq = neckq `Q.comp` (V3 16 0 0, Q.qz b )
crabCorpse :: StdGen -> Creature -> Shape
crabCorpse g cr = mconcat
[ colorSH (_skinUpper cskin) $ overPosSH (Q.apply torsoq) (upperPrismPolyHalfMI 5 $ polyCirc 4 10
& each . _x *~ 0.6)
, colorSH (_skinUpper cskin) $ overPosSH (Q.apply lclawq) (upperPrismPolyHalfMI 4 $ rectNSWE 20 0 (-2) 2)
<> overPosSH (Q.apply rclawq) (upperPrismPolyHalfMI 4 $ rectNSWE 0 (-20) (-2) 2)
]
where
torsoq = (V3 0 0 0,Q.qid)
-- not sure which rotation is done first
lclawq = torsoq `Q.comp` (V3 2 8 1, Q.axisAngle (V3 1 0 0) (-0.1) * Q.qz la)
(la,g') = randomR (-2,2) g
ra = fst $ randomR (-2,2) g'
rclawq = torsoq `Q.comp` (V3 2 (-8) 1, Q.axisAngle (V3 1 0 0) (0.1) * Q.qz ra)
cskin = crShape $ _crType cr -- this should be fixed
+9
View File
@@ -212,6 +212,15 @@ spiderJoint p q = (f $ Q.axisAngle (V3 0 (-1) 0) (pi - (a+b)), f . Q.axisAngle (
c = argV $ (p-q) ^. _xy
f x = Q.qz c * x
spiderJoint' :: Point3 -> Float -> Float -> Point3 -> (Q.Quaternion Float, Q.Quaternion Float)
spiderJoint' p l1 l2 q = (f $ Q.axisAngle (V3 0 (-1) 0) (pi - (a+b)), f . Q.axisAngle (V3 0 (-1) 0) $ a - b)
--spiderJoint p q = (Q.qz c, Q.axisAngle (V3 0 (-1) 0) $ a)
where
a = angleThreeSides 10 (distance p q) 10
b = angleVV3 (q-p) (V3 0 0 (-1))
c = argV $ (p-q) ^. _xy
f x = Q.qz c * x
deadFeet :: Creature -> Shape
{-# INLINE deadFeet #-}
deadFeet = feet