hello, I just recently made an ocean in my game and was thinking of how to add ocean noises, the ocean is made of a small part and inside the part is a mesh which scales really large as seen in the image, i want to make it so that there are ocean noises that play when you are near the ocean, how would i do this?
You should create some kind of structure that contains areas that either are or are not near the ocean. A grid is a good choice because its easy to find a specific square on a grid given a position. Each square should be marked with whether ocean sounds play. Then, continuously check if the player is in a grid square that should have ocean sounds. You could even find a way to auto-generate this grid but thats a whole other project.
In this example I imagine a grid where blue tiles contain all ocean, teal tiles are next to an ocean tile, and both blue and teal tiles should play ocean sounds. The way I’d generate this automatically is to use raycast “rain” to determine if a tile’s center point has land or water under it. If the raycast hits nothing, or hits something whose Y position is below sea level, it’s water.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.