I'm developing a 2D game in Godot. The engine doesn't matter in this case.
Given a polygon, convex or concave, and a listener (camera) location, what 2D position should an audio emitter be placed at to simulate audio coming from the entire polygon uniformly? The audio will be directional, and volume is automatically changed based on distance to the listener (camera). One challenge I anticipate is the case where the listener is partially surrounded by the polygon, but not inside of it.
The polygon in this case may be convex or concave. Example use cases include:
- Audio from a river (encapsulate the whole river within the polygon)
- Audio from a large zone/area, such as waves from the ocean, or animals from a forest