Rotate camera on chasm edges
This commit is contained in:
@@ -6,6 +6,7 @@ module Dodge.Update.Camera (
|
||||
updateCamera,
|
||||
) where
|
||||
|
||||
import Dodge.Update.Camera.Rotate
|
||||
import Linear.V3
|
||||
import Dodge.Creature.Radius
|
||||
import Bound
|
||||
@@ -226,14 +227,15 @@ rotateToOverlappingWall w =
|
||||
p = you w ^. crPos . _xy
|
||||
|
||||
doWallRotate :: Wall -> World -> World
|
||||
doWallRotate wl w
|
||||
| b - b' > 0.01 = w & wCam . camRot +~ 0.01
|
||||
| b - b' < negate 0.01 = w & wCam . camRot -~ 0.01
|
||||
| otherwise = w
|
||||
where
|
||||
a = argV (uncurry (-.-) $ _wlLine wl) - w ^. wCam . camRot
|
||||
b = a * (4 / pi) -- for 8 way cardinal orientation wrt wall
|
||||
b' = fromIntegral (round b :: Int)
|
||||
doWallRotate = rotateTo8 . argV . uncurry (-) . _wlLine
|
||||
--doWallRotate wl w = rotateTo8
|
||||
-- | b - b' > 0.01 = w & wCam . camRot +~ 0.01
|
||||
-- | b - b' < negate 0.01 = w & wCam . camRot -~ 0.01
|
||||
-- | otherwise = w
|
||||
-- where
|
||||
-- a = argV (uncurry (-.-) $ _wlLine wl) - w ^. wCam . camRot
|
||||
-- b = a * (4 / pi) -- for 8 way cardinal orientation wrt wall
|
||||
-- b' = fromIntegral (round b :: Int)
|
||||
|
||||
clipZoom ::
|
||||
-- | Furthest viewable distance
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
module Dodge.Update.Camera.Rotate (rotateTo8) where
|
||||
|
||||
import Dodge.Data.World
|
||||
import Control.Lens
|
||||
|
||||
rotateTo8 :: Float -> World -> World
|
||||
rotateTo8 a' w
|
||||
| b - b' > 0.01 = w & wCam . camRot +~ 0.01
|
||||
| b - b' < negate 0.01 = w & wCam . camRot -~ 0.01
|
||||
| otherwise = w
|
||||
where
|
||||
a = a' - w ^. wCam . camRot
|
||||
b = a * (4 / pi) -- for 8 way cardinal orientation wrt wall
|
||||
b' = fromIntegral (round b :: Int)
|
||||
|
||||
Reference in New Issue
Block a user