godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.53k stars 21.08k forks source link

AudioStreamPlayer2D Doesn't Move Proportional to Parent ParallaxLayer #79312

Open directrix1 opened 1 year ago

directrix1 commented 1 year ago

Godot version

4.1

System information

Godot v4.1.stable - Arch Linux #1 SMP PREEMPT_DYNAMIC Sat, 10 Jun 2023 00:35:35 +0000 - Vulkan (Compatibility) - AMD Radeon RX 7900 XT (gfx1100, LLVM 16.0.0, DRM 3.52, 6.3.7-arch1-1) () - AMD Ryzen 9 3950X 16-Core Processor (32 Threads)

Issue description

I have an AudioStreamPlayer2D as a child node of a background element. The background element, being on a ParallaxLayer, moves at a small fraction of the camera's (and AudioListener2D's) movements. Unfortunately, the AudioStreamPlayer does not honor this fractional moving so it does not stay aligned with the background element.

Steps to reproduce

Put AudioStreamPlayer2D on parallax background with some graphic and make the layer move at some small fraction of the distance as the camera with the AudioListener2D. Move the camera and AudioListener2D. The visual object will still be on the screen but the AudioStreamPlayer2D will be inaudible with a great enough distance.

Minimal reproduction project

AudioStreamPlayer2D Bug.zip

Calinou commented 1 year ago

I doubt this is intended to work in the first place. I'd probably document the limitation in the meantime.

directrix1 commented 1 year ago

Yeah, I'm sure it is just an unforeseen consequence of how the parallax layers work (and how nobody really thought to consider AudioStreamPlayer2D interaction with it), but I would imagine expected behavior would be for an AudioStreamPlayer2D placed on a background element to always sound like it's coming from that background element. Not a big deal in my particular case, and I'm working around it. I just thought I would report it.

rannsaka commented 5 months ago

I just encountered this same issue on my own, been driving me crazy trying to figure out what was going on.

Running 4.1.3 stable

Calinou commented 5 months ago

I suggest testing the new Parallax2D node in 4.3.dev6 (make a backup of your project before upgrading). It may address the issue outlined here.

markdibarry commented 1 month ago

Just tested the MRP converting to Parallax2D and works as expected. CanvasLayer strikes again!