I am working on a project making a 2d game and am trying to get the sound to play as you get closer to the object as well as panning depending on where the player is. Putting the max distance up to numbers higher than 50 will play the sound however any less there will be no sound which I don’t understand? I’m also unsure how to pan depending on where the player is. Help would be very appreciated! Thanks
I’m afraid we’ll need more information from you to understand what’s happening, but here’s how it’s supposed to work:
- Your game’s engine continually feeds FMOD the location of every event instance and listener in your game’s world.
- The FMOD Engine uses this information to calculate the position of each event instance relative to the listener, including the distance between the two.
- The FMOD Engine continually updates each event instance with information about its position relative to the listener. This includes updating the values of any built-in parameters that represent aspects of the instance’s relative position, and also causes effects that depend on position (such as the spatializer effect) to behave appropriately for the instance’s changes in position.
- The “min distance” of a spatializer effect represents the distance from the listener at which the event instance is not attenuated, and the “max distance” represents the distance at which the event instance is attenuated to the point of being silent. Between these extremes, the volume is ramped such that the closer the listener gets to the event instance, the louder it sounds.
In your case, you’ve mentioned that you can only hear the event instance if the max distance is higher than 50. This suggests that your listener and event instance are about 50 distance units apart. If you move the event instance and listener closer together, the event should become more audible. Is this not happening?
If you’re using a spatializer effect, panning should automatically be applied to the event instance based on its position relative to the listener. How is the event instance moving relative to the listener, and how does the panning change (or not change) when it does?
Could it be, that the listener position is the camera and not the player?
I assume you do a 2D jump n run like game?
In UE4 the listener is by default on the camera.