Skip to content

Commit 8a9db84

Browse files
committed
Add tutorials for blend animation and retargeting
1 parent 4297672 commit 8a9db84

File tree

12 files changed

+213
-0
lines changed

12 files changed

+213
-0
lines changed

tutorials/animation/animation_tree.rst

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

192233
Root motion
193234
-----------
37.9 KB
Loading
2.61 MB
Loading
19.9 KB
Loading
2.62 MB
Loading
4.77 MB
Loading
18.7 KB
Loading
34.3 KB
Loading
47.2 KB
Loading
19.4 KB
Loading

0 commit comments

Comments
 (0)