godot: AnimationTree: Improper blending of bone location when blending more than two animations
Godot version: Godot 3.2.4 rc1
OS/device including version: Windows 10 version 1909
Issue description:
When blending more than two animations using two separate Animation Nodes (such as a Blend2 being consumed by another Blend2), the location of bones isn’t properly interpolated if more than 2 animations are being blended together.
This is most noticeable when transitioning from a Blend Amount less than 1 to exactly 1, which causes a noticeable “snapping”, because values arbitrarily close to 1 have a noticeably different location. It seems rotations are interpolated smoothly.
I’ve also tested this with a BlendSpace2D within a BlendSpace1D, and using transitions to have a similar effect. Both have the same problem, where there’s a jarring transition when reaching an animation.
However, here’s a strange exception: if the blended node is put into the in
slot of a Blend2 and the third animation the blend
slot, it works fine.
Steps to reproduce:
- Create a model with three skeletal animations. For two of them, translate one or more bones (make sure to not just rotate them).
- Import the model and animations and create an AnimationTree using the model’s AnimationPlayer. Set its root as an AnimationNodeBlendTree
- Create a Blend2 of the translated animations. I also tested with a BlendSpace1D and BlendSpace2D. Set the blend_amount between 0 and 1 (exclusive)
- Create another Blend2. Set the
in
slot to use the third, non-translated animation, and setblend
to the translated animation blend.- (Important info: if you swap the
in
andblend
inputs, the problem goes away in this example. This could be a useful workaround, unless you’re blending between two blending nodes, which is my real use case, in which case the issue is present regardless of the input order).
- (Important info: if you swap the
- Slowly move the blend_amount of this new node from 0 to 1
- Watch as the animation snaps into place when going from 0.99 to 1
Minimal reproduction project:
Things to do in this project:
- Open the AnimationTree and slowly move the blend amount of
problem_blend
from 0 to 1. The box will snap when going from 0.99 to 1 and back. - Set the blend amount of
down
to 0 or 1 and repeat the previous step. The problem disappears - Swap the inputs of
in
andblend
forproblem_blend
and repeat step 1. The problem disappears
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 27 (27 by maintainers)
I don’t think there’s a “right” answer to “what should the blend triangle do to A if A doesn’t have a track like B and C do?” One answer would be to make A to default to the identity transform. Another option is to find some way to have B and C act as if the weight distribution was only between them. As another option, there could be a “Default Tracks” animation like the reset track, or perhaps use the reset track if it’s available…
Probably #34134