How to check if the specific object hear the specific sound?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Robotex

I want that my bots can react to sound emitted by player. How to check is the current bot hear specific sound? Should I create an area for each sound to detect collision with bodies who hear it?

Should I create an area for each sound to detect collision with bodies who hear it?

Sounds reasonable. What’s bothering you about that approach?

njamster | 2020-07-15 12:29

I guess there will be problems with sound refractions.

Also, sound speed is not imminent, so, I should inflate that sphere with some speed.

Robotex | 2020-07-15 12:36

I asked this question because there can exists more reasonable method and my method can be an inventing of bicycle

Robotex | 2020-07-15 12:37

You mean… reinventing the wheel? ;D

Sure, if you’re going for hyper-realistic gameplay than a simply Area won’t be enough! You didn’t mention any of that in your original question though. Are you talking about 2D or 3D btw? Personally I’d say that a very rough approximation of realistic sound is usually enough. As long as it feels reasonable, most players will probably be fine with it and won’t check if you calculated all the sound refractions correctly. :wink:

njamster | 2020-07-15 13:46

It’s 3D.

Ok, I will try this method.

Robotex | 2020-07-15 14:39

Sound travels instantly in Godot, so a progressively growing sphere wouldn’t reflect that.

Calinou | 2020-07-16 10:22

Sound travels instantly in Godot

Oh, I didn’t know that. Ok. I’ll make a sphere with diameter based on loudness.

Please, write this as answer, so, I’ll choose it as a best

Robotex | 2020-07-16 10:29