Open ndarilek opened 4 years ago
The title is inaccurate. This happens if there's no Camera in the scene, so 3D rendering is inactive. This might be intended and just needs being documented.
EDIT: Still valid in 43725691b btw
I think @Calinou may have mentioned wanting to add a warning if there are 3D nodes in the scene but no 3D camera. Is that an appropriate way to address this? I don't want users spinning their wheels trying to figure out why the pattern they used for 2D doesn't work in 3D, but at the same time I think that the current behavior does make sense to keep. So documenting it and maybe adding a warning seems like the best plan here.
If there is any use-case for sound-only 3D and it can be added without introducing overhead etc. then it could be fixed.
If not, adding a warning is ok.
There's absolutely a use-case for sound-only 3D. @ndarilek can expand on why if he's available but the basic version is that Godot does not support first-person audio listeners in top-down 2D games. I wish I was around for more of the 4.0 development cycle because there are so many things I'd like to rework. That's something that I wish we could support, for example.
I think we only have the Doppler effect in 3D, so having support for audio-only 3D makes sense too.
Sound-only 3D can be used to make games suitable for visually impaired players, such as AudioQuake, where sounds are used as spatial cues instead (or additionally to) 3D models. If this can be supported that's definitely nice to have.
Perhaps listeners should also work independently of cameras?
Hit this when trying to use
AudioStreamPlayer3D
in a 2-D world to get its advanced panning/rotation support. Essentially I'm syncing the X and Z coordinates ofAudioStreamPlayer3D
nodes with the X and Y coordinates of aNode2D
parent, as well as their rotations. This seems to work OK for sound sources, but it failed forListener
and took days plus help to debug.Essentially, I can't have a
Listener
as a child of aNode2D
(or even aSpatial
) and get audio. Instead, I have to:Viewport
.Camera
as a child of the viewport. I don't want 3-D rendering, so I hope this prevents any visible rendering.Listener
as a child of that camera.Once I've done that, I can sync
AudioStreamPlayer3D
nodes with aNode2D
parent. I can also sync theListener
with anotherNode2D
, but I can't use the parent-child relationship. I have to tag it.I looked through the listener source, and don't immediately see where it would fail if there isn't a
Camera
in its ancestry.Here is a fairly minimal reproduction of what I tried and failed. The reproduction uses a
Spatial
as theListener
parent, but it'd also be nice if I could use aNode2D
. I figured aSpatial
parent would be the least likely to fail though, but it did.Using a custom built Godot 3.1.1.
Thanks.