godot icon indicating copy to clipboard operation
godot copied to clipboard

AnimationTree -> StateMachine -> Animation calling audioplayer broken

Open Lakshman-YT opened this issue 1 year ago • 3 comments

Tested versions

The issue with this bug is in version 4.3 (stable). My project was working fine on version 4.2.2 (stable), but as soon as I upgraded, the bug appeared. (After checking with other releases). the bug appeared at Godot v4.3-rc1

System information

Windows 11 - Godot v4.0.3.stable - vulkan (Forward). intel i5 16gb ram , 512ssd , RTX 3060

Issue description

I have a player in my scene that contains some of its behavior animations. For its sound, I added an AudioStreamPlayer3D and assigned a stream (the length of the audio is approximately less than 1 second). To make the AudioStreamPlayer play audio, I set keyframes to trigger the audio at specific points in the animation. Until this point, everything is fine; when I play the animation, the AudioStreamPlayer triggers the audio properly. However, when I add a state machine using the AnimationTree node, the animation for the player performs well, but it does not play the audio properly, and some animations have audio delays. It was working fine in version 4.2.2 (stable) but not in 4.3 (stable). There are no errors or issues being raised.

Steps to reproduce

  1. Have a basic player with a few animations (such as sound effects for jumping, walking, etc.).
  2. Add an AudioStreamPlayer3D, and assign the sound to the AudioStreamPlayer, ensuring that looping is turned off.
  3. Add keyframes inside any animation to trigger the "playing" property of the AudioStreamPlayer.
  4. Create a basic state machine (either complex or a basic one-shot). When you fire the one-shot animation, the AudioStreamPlayer will not run properly.

Minimal reproduction project (MRP)

godotissue.zip

  1. Fire the oneshot animation and see the delay in audio ( animation in AnimationPlayer is RunToStop).
  2. Change the value of BlendSpace1d to 1 and can listen , there is no proper audioplaying for run. ( RunLoop in animationplayer do play the proper audio but not AnimationTree)

Lakshman-YT avatar Sep 06 '24 17:09 Lakshman-YT

Just to make sure, can you check this link https://godotengine.org/article/migrating-animations-from-godot-4-0-to-4-3/ to see if your case is about any of these changes, i saw lot of issues related to this changes so is good check if is your case too.

matheusmdx avatar Sep 07 '24 15:09 matheusmdx

Just to make sure, can you check this link https://godotengine.org/article/migrating-animations-from-godot-4-0-to-4-3/ to see if your case is about any of these changes, i saw lot of issues related to this changes so is good check if is your case too.

"Note: The issue was accidentally closed and reopened. The problem is still active, and I’m looking for a solution."

Well, this looks like a project transfer from Godot 4.0 to 4.3 (maybe 4.2 if I’m wrong). I have gone through the document (from the link you provided), but the solution isn’t in there. This issue is something different. It seems that in 4.3, adding new keyframes to an external animated model (AnimationPlayer) doesn’t integrate properly in Godot. The newly added keyframes are played only after the animation is completed. Though playing the AnimationPlayer directly works fine, the issue occurs when using it through the AnimationTree.

Lakshman-YT avatar Sep 07 '24 17:09 Lakshman-YT

Adding a +1 here

botha-dev avatar Sep 22 '24 20:09 botha-dev

Dupe of https://github.com/godotengine/godot/issues/95684

TokageItLab avatar Oct 05 '24 17:10 TokageItLab