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

AnimationTree unexpected blend node results - drift on x axis #60306

Closed
shuvit-game opened this issue Apr 16, 2022 · 13 comments · Fixed by #60308
Closed

AnimationTree unexpected blend node results - drift on x axis #60306

shuvit-game opened this issue Apr 16, 2022 · 13 comments · Fixed by #60308

Comments

@shuvit-game
Copy link

Godot version

v4.0.alpha.calinou [3d8c971]

System information

Windows10, Vulkan

Issue description

Blend2 and Blend3 AnimationTree nodes are producing unwanted movement on my character rig. Seems to be only on or related to x axis.

If it's something with the rig, advanced apologizes, it's driven me mad.

br.mp4

4

Steps to reproduce

Not sure if this is specific to my rig, but it may be related to not having a root or master bone.

Minimal reproduction project

anim_blend_test.zip

@TokageItLab
Copy link
Member

@shuvit-game Ahhh indeed. This is a clear case of quaternion approximation by exp map causing errors. Thanks for sharing this with us. Using slerp to interpolate quaternions in blending by #60308, this issue will be fixed.

2022-04-17.4.46.22-1.mov

@shuvit-game
Copy link
Author

That was quick! Thank you very much for doing the work.

@shuvit-game
Copy link
Author

This fixed the main issue and some others that I was having, but I noticed this specific blend is still having issues, the opposite foot doesn't have the issue and i haven't identified any other problems:

blends.mp4

@TokageItLab
Copy link
Member

TokageItLab commented Apr 17, 2022

This is probably due to the fact that the Hips are animated on a nearly 180 degree rotation from Rest. I would predict that after the motion of rotation the character would be facing backwards.

The current blending is interpolated so that it does not rotate more than 180 degrees from Rest. So if you want to use blend animation with the character facing backward, it is safe to rotate the character as Node with using script (and root motion, maybe). But, if you really want to solve that on BlendTree, we should make to be able to update Rest in the middle of animation process, or possibly PhaseNode #57959 might help with that.

@shuvit-game
Copy link
Author

The problem above appears to be related to my rest pose, and not any issues. Initial testing shows that rotating the rest -90 solves it.

@shuvit-game
Copy link
Author

Update: rotating the rest introduced a whole bunch of new issues and broke other blends.

@TokageItLab
Copy link
Member

TokageItLab commented Apr 18, 2022

So I recommend to rotate the character as Node with using script with root motion or something, please test it or send sample project. In that case, I think the motion involved in the character's "turn rotation" would need to be separated to the root bone animation as the parent of the Hips, not the Hips.

@TokageItLab
Copy link
Member

TokageItLab commented Apr 18, 2022

Or, as I said in #57675 (comment), if we could mark the option to do a blend that always takes the shortest path, taking into account the previous frame, I think this would solve the problem completely.

But to do that I need to think about blending that takes the shortest path considering the previous frame and does not cause inconsistencies in more than 3 blends... I will think about it for a while... For implement that, it is also difficult to always determine the direction of rotation from the previous frame. Since the animation does not have a single static value basically and the value will be changing constantly, the direction of rotation can change abruptly by playback time. This means that animations will glitch as they move around the flip border unintentionally. (BTW in 3.x, starting determine the direction of rotation from the first connected node to next connected node in the blending process, so the blending was inconsistent and this implementation needs to be also avoided.)

After all, the only meaningful solution is to rotate the player as Node with using script and root_motion.

@TokageItLab
Copy link
Member

TokageItLab commented Apr 18, 2022

@shuvit-game Alright, I sent some RootMotion fixes as #60336 and #60349. After they are merged, try to change the way the character rotates in your project by referring to sample project in #60342.

If that does not solve the problem, we will need to discuss... maybe #29458?

@TokageItLab
Copy link
Member

I have found a problem with the root motion (godotengine/godot-proposals#4418), please wait a while until it is fixed.

@TokageItLab
Copy link
Member

TokageItLab commented May 18, 2022

@shuvit-game #60774 is now merged, please try using RootMotion with taking the rotation that changes the orientation of the character from the Hips transform as a rotation of the Root bone.

@shuvit-game
Copy link
Author

Thanks, will do as soon as I can. Looks promising.

@shuvit-game
Copy link
Author

@TokageItLab After just brief playing with my current project, this seems to have resolved the issues. I will open a new issue if further testing reveals anything. I think most previous issues were one-shot related.

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

Successfully merging a pull request may close this issue.

2 participants