Playing Audio Near A Large Ocean Mesh

Hello hello!

Ive got a huge ocean in my scene, which surrounds an island. I’d like a water loop to play when near it. Rather than putting audio components everywhere on top of the ocean, it seems to me it would be a lot more useful to just play audio when near the ocean mesh.

Does anyone have any advice?

I was thinking about triggering it when overlap another hidden ocean shaped object i put above the ocean surface, that kind of thing. Then i wondered if i could attach audio directly to the ocean mesh instead, and add some attenuation. Let me know if i’m completely on the wrong track with my thinking - have never had to do something like this before.

Much appreciate your time!

Getting some result with this using blueprints, still trying.

The challenge for me in particular is the custom ocean shape (it’s a mesh that surrounds an island), and adding audiocomponent as a sub component to the mesh in the BP on its own only plays the audio at 0,0,0 which is not what i wanted.

Advice still very welcome

pass in the players world location to your play sound at location?

A few ideas in order of ascending complexity.

  1. Put a trigger volume on the places where you don’t want to hear the ocean, and only turn on the audio component when you leave that trigger volume.
  2. Create an array of locations in your world that sparsely cover the coast. In blue print iterate over those locations, placing an audio component at each one, with attenuation settings such that they don’t overlap.
  3. Emulate the “footsteps by material” pattern for setting footsteps sound. Pick a point above your character’s head, then every so often perform a line trace in a cone-shaped area pointing downwards and centered on your character. Set the height and opening angle of your cone such that if any of those line traces terminate on your ocean material, then you are close enough to the ocean to want the ocean ambient sound on. You can also use the line trace hit location to set the location of the audio component so that it sounds like it’s coming from the right direction.

A good trick is laying a spline along the coast, a little bit out to sea, to function as a track for an audio component. It’s on a virtual trolley, and we tell the trolley to stay as close to the player as possible. From player perspective the sound of the sea will always be there. Use this in conjunction with smaller splines or static placed sounds, because when out on some spit of land we’ll be surrounded by ocean.