Muzzle pushback direction depends only on wall line
This commit is contained in:
+3
-3
@@ -359,12 +359,12 @@ muzzleWallCheck w cr = fromMaybe cr $ do
|
|||||||
if null vs
|
if null vs
|
||||||
then cr
|
then cr
|
||||||
else
|
else
|
||||||
let v = minimumBy (compare `on` norm) vs
|
let (_,wl) = minimumBy (compare `on` norm . fst) vs
|
||||||
in cr & crPos . _xy +~ normalize v
|
in cr & crPos . _xy +~ signorm (vNormal (uncurry (-) (wl ^. wlLine)))
|
||||||
where
|
where
|
||||||
f loc = map (muzzlePos loc cr) (itemMuzzles loc)
|
f loc = map (muzzlePos loc cr) (itemMuzzles loc)
|
||||||
g cp wls p = case collidePoint cp p wls of
|
g cp wls p = case collidePoint cp p wls of
|
||||||
(ep, Just _) -> Just (ep - p)
|
(ep, Just wl) -> Just (ep - p, wl)
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
updateCreatureStrides :: World -> World
|
updateCreatureStrides :: World -> World
|
||||||
|
|||||||
Reference in New Issue
Block a user