godotengine / godot

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

AnimationPlayer does not play animations #85555

Open Zurrdroid opened 9 months ago

Zurrdroid commented 9 months ago

Godot version

4.2

System information

Godot v4.2.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU (NVIDIA; 31.0.15.3640) - AMD Ryzen 7 5800H with Radeon Graphics (16 Threads)

Issue description

Animating node properties does not work while using the AnimationPlayer node, both for projects upgraded to 4.2 from 4.1 and fresh ones. Keyframes store the changed values, but they do not update while the animation is playing

Steps to reproduce

  1. Create a Node3D with a MeshInstance3D as child
  2. Create an AnimationPlayer as child of the Node3D
  3. Create a new animation for the AnimationPlayer
  4. Keyframe properties (such as transform position, rotation or scale) for the Node3D
  5. Set animation to autoplay and loop
  6. Run scene

Minimal reproduction project

AnimTest4.1.zip AnimTest4.2.zip

Note: The 4.1.1 project is a copy of the 4.2 project, downgraded to 4.1.1

lvcivs commented 9 months ago

I tried the steps provided but can't reproduce the issue. It works as expected (on Linux).

The zip contains only a binary which I didn't try.

Zurrdroid commented 9 months ago

The zip contains an unpacked project, you'd have to open it using the editor(s) for the respective version. The exported versions are attached:

4.1.1.zip 4.2.zip

The 4.1.1 works as expected, but the 4.2 version does not. I'll try and create a project on a different machine to test it out.

EDIT: I've created a project on a different machine using 4.2 and am facing the same issue:

Machine specs: Godot v4.2.stable - Windows 10.0.22621 - Vulkan (Forward+) - integrated Intel(R) UHD Graphics 620 (Intel Corporation; 31.0.101.2111) - Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz (8 Threads)

AnimTestNewMachine.zip

americoperez49 commented 9 months ago

The problem seems to have something to do with the track that I circled in red in this screenshot image

lvcivs commented 9 months ago

I also saw that extra track with a pink icon in my test. Not knowing what it was, I deleted it.

Zurrdroid commented 9 months ago

Yep, that seems to be the source of the problem. It appears if you add a "3D Rotation" track using the "Add Track" button. If this is intended behavior, it has changed since 4.1.1, but is not a bug. I'm not entirely sure, but I'll mark this as resolved since this is probably user error on my part.

kevinloustau commented 9 months ago

The problem seems to have something to do with the track that I circled in red in this screenshot image

Same issue upgrading a project. Some of my animations have this red circle “empty” tracks. Deleting them resolves the problem.

NOTE: I am not sure at 100%, but I think I had these tracks on godot 4.1, but it never threw errors.

YuriSizov commented 9 months ago

I don't think we should close this just yet. This doesn't seem correct to me that some empty moot tracks appear after the migration and break things.

TokageItLab commented 9 months ago

If that unintended track is added on import as @YuriSizov says, then it is a bug, otherwise it is just a usability issue and not regression.

Trying to assign the same parameter with two different types of tracks in one animation is possible in the GUI, but should never be allowed because AnimationPlayer will not handle it correctly. It is a lack of foolproof feature in AnimationTrackEditor.

The fact that it miraculously worked in 4.1 may have something to do with the cache handling that was changed in 4.2 (see also https://github.com/godotengine/godot/pull/85604#issuecomment-1838795586). But in any case it is already not working correctly in 4.1, because depending on the order of the tracks, one of the two conflicting tracks is ignored.

akien-mga commented 1 month ago

@TokageItLab I think we should probably either raise a warning, or ignore such empty tracks (or both, raise a warning once but ignore them and play the animation with that track ignored).

It's still unclear how any of the users reporting this ended up with such empty tracks in the first place. But there's no clear steps to reproduce that UX issue so it doesn't seem addressable for now.

TokageItLab commented 1 month ago

@akien-mga I think it is impossible to deal with them at this time. In the case above, there is a RotationTrack and a ValueTrack, but their paths are different, so the conflict cannot be detected.

I remember that one of the reasons Pos/Rot/Scl/BlendShape tracks were introduced in the first place was to reduce the acquisition of the target object. So basically, Node3D/transform and MeshInstance3D/blendshape should not use the Value track.

One UX issue I am aware of right now and where I think it could be improved is that keying in the inspector inserts the 3D transform as a ValueTrack, which can be confusing when creating a track from the TrackEditor. (BonePose correctly inserts the PosRotScl track because it was implemented later as InspectorPlugin.)

So I think we need to have specific hints in some Properties so that they do not insert ValueTracks by default when keying, such as interspersing a selection in the dialog like using Bezier.