-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Setting bone rotation in _process gets overridden by running animation in 4.1-dev3 #77548
Comments
It seems like changing the AnimationPlayer's Thread Group to anything other than "Inherit" causes this to behave as intended. This may be related to the multi-threading work being done as part of Godot Proposal #6424. |
Ah, you're right. And it seems changing |
Wasn't actually fixed by #78713. |
Hmmm... I can't reproduce it on current |
Weird, it reproduced for me on Linux with and without that PR. And I confirmed that with 4.1-dev2 the head properly follows the |
Just tested on latest master at 1f9e540 with #78713 in it unfortunately the issue remains. The issue can be pretty subtle to notice, the small head tilt can easy to miss. I had to look around to understand what was wrong when I initially tested this. Also remember to set the AnimationPlayer to play and loop in the editor. Workaround mentioned in #77548 (comment) also still works, although I don't quite understand why. Not working image (animation is playing and looping): Setting AnimationPlayer thread group to Main Thread |
I was silly enough not to realize I should plat the animation. Let's throw a heavy veil over that... Investigating now. |
First of all, as long as both the animation player and the node controlling the head have the same process priority, there are no guarantees about the order in which they will be processed. Moreover, if they were, they would be tree-order, which would lead to the current behavior anyway. So, to me, the change of behavior between 4.0 and 4.1 is due to observed side effects of implementation details that users shouldn't rely on. The way a user would have this under control and get the wanted outcome is to set the priority of the animation player to -1 or that of the root node to 1. Aside, I've spotted a few little bugs in the code handling the Thread group properties, that explain the unable-to-reset, etc. issues. I'll PR to fix them. Aside again, I'd still have to reason about the fix of putting the animation player in its own processing group, because, with the default priority of 0, we may be in the same situation as with the processing order. I mean, the root node would be in the implicit default process group, which is priority 0, too, so there would not be order guarantees in that case either. |
I don't see any indication that this project or scene enabled the new node multithreading. If everything is set to inherit, all nodes should be running on the main thread, and hence the order should be deterministic. This quote from @RandomShaper 's comment does not make sense to me in the context of a scene running with the default settings.
This does not match what is written in the documentation.
Many of my scripts relied on the deterministic processing order defined in Godot. Having a well-defined process order by default is a welcome feature compared to Unity's generally undefined update order. |
As I understand it, we have groups (processed in group process order) and each has nodes (processed in node process priority). So, what I say (right or wrong) applies to both threaded and non-threaded situation, as long as the involved nodes belong to the same group. Regarding if the order of nodes is deterministic or not, I may indeed be wrong. I think I was told it wasn't anymore, but judging by the code, it still is. |
In any case, the update of the skeleton is made deferredly, which may not be relevant, provided there are many flushes during the processing of the frame that may make the analysis of this as simple as if those updates were just sequential. On current 4.1 this happens on each iteration in the MRP:
I'll check 4.1-dev2. |
I think I've spotted something serious regarding internal/non-internal process. @lyuma, I think you were on the right track. Sorry for the many updates. I'll come back with specifics in the next one. |
@RandomShaper Thanks for the explainers both here and in the PR! I compiled the engine with your changes and can confirm it works. |
The second batch of changes caused the script to not work again. Having read the discussion and fixes, this is how it should be. Lower nodes in the tree (i.e. the AnimationPlayer / AnimationTree) are processed after higher nodes (root node). I'll just leave what I did here for future reference. One workaround could be to attach a second script on the animation player and overwrite the animations there. The engine will run the internal stuff first and then run your script. I didn't want to do that (too troublesome for multiple scenes) so I ended up changing the process priority in the top-level script and it works fine for my purposes:
|
I am sorry. I see it was fixed but I can still reproduce this in v4.2.1.stable.official [b09f793] Am I missing something? Or I do need to change the thread group to "Main Thread" in AnimationTree node as stated in #77548 (comment) Thanks |
@nagasawamaki attach the override logic on the animation node or a node lower down the tree, or change the |
Hi, thank you for your comment. I have tried your method but it doesnt work for me |
@KMouratidis for the "top-level script" do you mean the direct parent of the animationTree node? I have tried to set Thanks. |
I also made another issue #87428 but it seems it is intended behavior in Godot that bone rotation cannot be overridden when running animation by design... |
Godot version
4.1 dev3
System information
Windows 11, Forward+, Intel 13700k, 4070ti
Issue description
In 4.0.x and in 4.1 dev2, if you overwrite the rotation of a bone in
_process
it has preferred over the currently running animation. In 4.1 dev3, the running animation takes precedence and overwrites any changes in_process
. This happens both with a simple animation and with an animation tree, and happens in-editor and in-game.Steps to reproduce
AnimationPlayer
and pick an animation, e.g.Armature|Standing
. Set it to looping if it's not already. (@RandomShaper's note: and play it).PointOfInterest
and move it along the X axis.Minimal reproduction project
BoneRotationIssue-4.0.3.zip
BoneRotationIssue-4.1-dev.zip
Should include all licensing stuff for the model, but let me just add the link for good measure.
The text was updated successfully, but these errors were encountered: