Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When multiple AnimationTrees are active in the same scene only the last AnimationTree result is applied #80951

Closed
KnightNine opened this issue Aug 24, 2023 · 3 comments

Comments

@KnightNine
Copy link

KnightNine commented Aug 24, 2023

Godot version

4.1

System information

Windows 10

Issue description

Just noticed that I can no longer use the same AnimationPlayer across multiple AnimationTrees like I could in 3.X and I thought it was worth mentioning.

Here is a test scene, one AnimationTree handles the colorrect changing color, the other handles the colorrect changing the color's alpha value. note how the next animTree to become active overrides the cycle being run by the last animTree.

animation lock

I've found that priority of which animation tree is allowed to work is based on the order of the nodes in the scene tree (last having a higher priority).

I can fix this by having an animation player for each animation tree though I didn't need to do this in 3.X.

Steps to reproduce

Set the anim_player property of two AnimationTrees (using AnimationNodeStateMachine as their tree_root property ) to the same AnimationPlayer and try to run them both at the same time.

What is being animated doesn't seem to matter.

Minimal reproduction project

Test.zip

@KnightNine KnightNine changed the title Every AnimationNodeStateMachine using the same animation player before the last in the order of nodes fails to work when active. Every AnimationNodeStateMachine using the same AnimationPlayer before the last in the order of nodes fails to work when active. Aug 24, 2023
@KnightNine KnightNine changed the title Every AnimationNodeStateMachine using the same AnimationPlayer before the last in the order of nodes fails to work when active. Every AnimationNodeStateMachine using the same AnimationPlayer before the last in the scene tree's order of nodes fails to work when active. Aug 24, 2023
@KnightNine KnightNine changed the title Every AnimationNodeStateMachine using the same AnimationPlayer before the last in the scene tree's order of nodes fails to work when active. Every AnimationNodeStateMachine using the same AnimationPlayer before the last in the scene tree's order of nodes fails to work when active. Aug 24, 2023
@TokageItLab TokageItLab changed the title Every AnimationNodeStateMachine using the same AnimationPlayer before the last in the scene tree's order of nodes fails to work when active. When multiple AnimationTrees are active in the same scene only the last AnimationT is active Aug 31, 2023
@TokageItLab TokageItLab added usability and removed bug labels Aug 31, 2023
@TokageItLab
Copy link
Member

Probably this is the expected behavior, but I guess you could propose an option like AnimationTree.priority for when another AnimationTree is already manipulating the same object.

@TokageItLab TokageItLab changed the title When multiple AnimationTrees are active in the same scene only the last AnimationT is active When multiple AnimationTrees are active in the same scene only the last AnimationTree result is applied Aug 31, 2023
@TokageItLab
Copy link
Member

If you want to apply both results of the two Trees, then this issue is exact a duplicate of #80971.

@TokageItLab TokageItLab closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2023
@KnightNine
Copy link
Author

KnightNine commented Sep 1, 2023

If you want to apply both results of the two Trees, then this issue is exact a duplicate of #80971.

Yeah, just realized that this issue is probably directly caused by #80971 since both animation trees are using the same anim-player and once the second anim-tree tries to run an animation, the unused parameters (across the anim-player being used) of the animation run within the second anim-tree are forced to be reset and this overrides the first anim-tree trying to animate anything.

This is hard to explain concisely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants