Sound of speed variable

Hello,

I heard about a variable called SpeedOfSoundSq, that we can find here: SpeedOfSoundSq | Unreal Engine Documentation
I would like to change the value so when a character is shooting for example, an other character on the other side of the map will hear it with a certain delay (depending on the speed if sound). The problem is that I don’t know what are the units for this variable. I mean is it in m/s, feet/s, or something else ?

Thanks you,
Kendrick

ps: I have no competence in C++. I’m developing in blueprint only, I’m using a custom version of UE 4.12+ Nvidia gamework.

Generally ue4 handles units in centimeters, I would start testing with the assumption of cm/s and time profiling objects in the level that are listening for the event alone to determine if my assumptions were correct.

I found this on the net: https://wiki.beyondunreal.com/Legacy:Unreal_Unit

So I try in cm/s and then if it’s not that great, should I try in UnrealUnits/s ?

No, that is for Unreal 3/UDK. In Unreal 4 (as far as I know) length is expressed in centimeters as Spiris said.

Thx I’ll try it
But I have a little problem. Which one should I change ? Because there’s a float and an Integer. And it seems like there’s an equation here:

const float Delay = SpeedOfSoundSq > 0.f ? FVector::DistSquared(Event.NoiseLocation, Listener.CachedLocation) / SpeedOfSoundSq : 0;

Not sure what you are referring to with float and integer?

That is the implementation of the function using the ternary operator which has the form:

Value = If(some condition) ? (value to use when the condition is true) : (value to use when the condition is false)

It can be rewritten as follows (in meta code):

if(SpeedOfSound > 0)
{
    Delay = DistanceBetweenActorAndSound / SpeedOfSound
}
else
{
    Delay = 0
}

In any case, this results in a delay between the sound playing and the character sensing the noise.

Speed of sound will have to be in cm per second because the distance between the sound and actor is expressed as centimeters. Real world would be a value around SpeedOfSound = 34300 cm/s.

Ok I just got it!
Thank you very much I’ll try it ASAP and let you know!