Reduce positional effect on sounds
This commit is contained in:
@@ -157,15 +157,23 @@ Within 10 units considers the sound to be directly in front.
|
||||
soundAngle :: Point2 -> World -> Int16
|
||||
{-# INLINE soundAngle #-}
|
||||
soundAngle p w
|
||||
| dist p earPos < 10 = 0
|
||||
| d < 10 = 0
|
||||
| otherwise =
|
||||
round
|
||||
. radToDeg
|
||||
. f
|
||||
. normalizeAngle
|
||||
. (+ pi)
|
||||
$ argV (vNormal (p -.- earPos)) - (w ^. wCam . camRot)
|
||||
where
|
||||
earPos = w ^. wCam . camViewFrom
|
||||
d = dist p earPos
|
||||
-- the following should soften the positional effect
|
||||
-- when you are close to the sound source
|
||||
f x | x < pi / 2 = x * dfact
|
||||
| x < 3 * pi / 2 = pi + (dfact * (x - pi))
|
||||
| otherwise = 2*pi + (dfact * (x - 2*pi))
|
||||
dfact = min ((d - 10) / 100) 1
|
||||
|
||||
{- | Uses the first free origin from a list.
|
||||
Does nothing if all origins are already creating sounds.
|
||||
|
||||
Reference in New Issue
Block a user