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

Unexpected rotation animation blending result (quaternion slerp vs animation blending) #60262

Closed
nsf opened this issue Apr 15, 2022 · 4 comments

Comments

@nsf
Copy link

nsf commented Apr 15, 2022

Godot version

4.0 alpha 6

System information

Linux, Vulkan

Issue description

I have a simple blend tree setup where I blend two animations. Each animation consists of a single quaternion keyframe. Thus it's not even an animation per se. Of course this is a minimally reproducable example, in real use case I blend between proper two animations.

So, basically, I blend between two quaternions and I expect the result of such blend operation to be equivalent to "slerp" between two quaternions, in particular the shortest rotation path needs to be taken, however animation blending gives a different result. Here are the two videos of it.

Quaternion slerp using tweens and a script (this is what I expect):

slerp.mp4

And this is the blending between two animations using AnimationTree:

blend.mp4

I've seen some recent pull requests in this area, where code does some quaternion magic to make it "right", e.g. #57675, might be related.

Perhaps this small use case might be helpful.

Steps to reproduce

Run the test project, by default it will play the tween animation and you can inspect the AnimationTree node in the editor by activating it first.

Minimal reproduction project

I've pushed the test project to github: https://github.com/nsf/GodotSlerpTest

@nsf
Copy link
Author

nsf commented Apr 15, 2022

Additional note: it works as expected in 4.0 alpha 4

@TokageItLab
Copy link
Member

TokageItLab commented Apr 16, 2022

@nsf I think maybe it has been already solved by #60093 and #60235. So If you are using ValueTrack or Rotation3DTrack with Node3D, you need RESET track to determine the direction of rotation; if you are using Rotation3DTrack with Skeleton3D::Bone (I guess above video is not so), you need set the correct Rest. I know this thing needs to be added to the documentation later.

If you can build engine, please test it, or wait next alpha.

@TokageItLab
Copy link
Member

TokageItLab commented Apr 16, 2022

I tested, probably it seems fine with RESET.

2022-04-16.22.56.10-1.mov

GodotSlerpTest-main_fixed.zip

@nsf
Copy link
Author

nsf commented Apr 16, 2022

Yes, I just compiled it from git and I can confirm it works fine with RESET track. Thanks.

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

5 participants