Sound Travel Time (Speed of sound)

Hi,

I’m trying to add a “speed of sound” function to my sound cues. Basicly at distances there should be a delay for sounds to reach the player.

Is there any node i can use or do i have to create my own function or something?

Thanks in advance for any help you are able to provide!

Interesting question. There is a node that uses distance for crossfade so making a new one to delay by distance may not be too difficult.

I honestly have no solid understanding of the sound system inner workings but i would be on the lookout for how/when sound nodes are run to verify it gets accurate location data on single and multiplayer.

I’ve been thinking of using the delay node where the delay time is determined by this formula:

     Distance(m)
-------------------- = Delay
Speed of sound (m/s)

However then comes the question how I replicate diffrent sounds to all clients in a multiplayer game.

Is it even possible to replicate sound? If so then how would I as said, replicate diffrent sounds to diffrent players?

Solved it.

I made a server function that called a multicast function.
The multicast function has a timer in it to act as delay. The delay is calculated by dividing the distance by the speed of sound (340). The distance is calculated by getting the distance between the local player (the player that the multicast function is being called on) and the location of the sound.

And when the timer is done i play a sound at location.

Code: