- Home /
How can I wrap 3D audio around the edge of a toroid game level?
This question deals well with the problems of triggers and collision detection across the boundaries of a wrapped game world:
http://answers.unity3d.com/questions/336828/how-should-i-implement-collision-detection-in-a-wr.html
However, neither the question nor the answer say anything about how to wrap audio across the boundary. Unity seems to get very upset if I have more than one active audio listener at one time, so extra listeners over the border don't seem to be the answer. Is there a way to tackle this anyone here is familiar with other than manually coding every sound effect to play in nine places?
Answer by Jonatan Crafoord · Feb 18, 2015 at 04:22 PM
About a year late to the party, but this question popped up as a related question of another one that I just answered, so I'll give my 2 cents here as well! Even if you've already solved it, someone else may struggle with a similar problem.
I think the best way of accomplishing this is probably to ditch Unity's built in 3D-positioning altogether, set all sounds to 2D, and then write a custom class that measures all playing audio sources' relationships to your game camera (accounting for the wrapping effect), and sets volume and pan manually. You'll have to go a few more steps if you want it to work in surround as well, but for stereo it shouldn't be insurmountable.
Good luck!