Skip to content

Commit 4024e8f

Browse files
authored
Merge pull request #6322 from TokageItLab/tuts-for-blend-and-retarget
Add tutorials for blend animation and retargeting
2 parents 085cd91 + 046bcd4 commit 4024e8f

File tree

12 files changed

+215
-0
lines changed

12 files changed

+215
-0
lines changed

tutorials/animation/animation_tree.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,48 @@ Transitions also have a few properties. Click any transition and it will be disp
188188
* *Priority* is used together with the ``travel()`` function from code (more on this later). Lower priority transitions are preferred when travelling through the tree.
189189
* *Disabled* toggles disabling this transition (when disabled, it will not be used during travel or auto advance).
190190

191+
For better blending
192+
-------------------
193+
194+
In Godot 4.0+, in order for the blending results to be deterministic (reproducible and always consistent),
195+
the blended property values must have a specific initial value.
196+
For example, in the case of two animations to be blended, if one animation has a property track and the other does not,
197+
the blended animation is calculated as if the latter animation had a property track with the initial value.
198+
199+
When using Position/Rotation/Scale 3D tracks for Skeleton3D bones, the initial value is Bone Rest.
200+
For other properties, the initial value is ``0`` and if the track is present in the ``RESET`` animation,
201+
the value of its first keyframe is used instead.
202+
203+
For example, the following AnimationPlayer has two animations, but one of them lacks a Property track for Position.
204+
205+
.. image:: img/blending1.webp
206+
207+
This means that the animation lacking that will treat those Positions as ``Vector2(0, 0)``.
208+
209+
.. image:: img/blending2.webp
210+
211+
This problem can be solved by adding a Property track for Position as an initial value to the ``RESET`` animation.
212+
213+
.. image:: img/blending3.webp
214+
215+
.. image:: img/blending4.webp
216+
217+
.. note:: Be aware that the ``RESET`` animation exists to define the default pose when loading an object originally.
218+
It is assumed to have only one frame and is not expected to be played back using the timeline.
219+
220+
Also keep in mind that the Rotation 3D tracks and the Property tracks for 2D rotation
221+
with Interpolation Type set to Linear Angle or Cubic Angle will prevent rotation of more than 180 degrees
222+
from the initial value as blended animation.
223+
224+
This can be useful for Skeleton3Ds to prevent the bones penetrating the body when blending animations.
225+
Therefore, Skeleton3D's Bone Rest values should be as close to the midpoint of the movable range as possible.
226+
**This means that for humanoid models, it is preferable to import them in a T-pose**.
227+
228+
.. image:: img/blending5.webp
229+
230+
You can see that the shortest rotation path from Bone Rests is prioritized rather than the shortest rotation path between animations.
231+
232+
If you need to rotate Skeleton3D itself more than 180 degrees by blend animations for movement, you can use Root Motion.
191233

192234
Root motion
193235
-----------
10.6 KB
Loading
441 KB
Loading
7.93 KB
Loading
440 KB
Loading
943 KB
Loading
6.45 KB
Loading
11.6 KB
Loading
14.2 KB
Loading
6.53 KB
Loading

0 commit comments

Comments
 (0)