godot-animation
Installation
SKILL.md
Animation (4.7)
Asset-side work (rigging, clips, root motion export) belongs in Blender. See the blender-animation and blender-export-pipelines skills if they're installed.
AnimationPlayer
- Animations live in
AnimationLibraryresources. The default library is"", soplay(&"run")works, and other libraries are addressed as&"lib/run". Imported GLB clips arrive as a library. Make a clip loop in the import settings (or with a-loopsuffix) instead of editing the imported animation. play(name, custom_blend, speed),play_backwards,queue,seek(t, true),speed_scale. Theanimation_finished(name)signal lives onAnimationMixer.play_with_captureblends from the current pose.- Tracks can set any property, call methods (
TYPE_METHOD), play audio, run Bezier curves or start other animations. Use method tracks for footsteps and hit frames instead of timers. - 4.6 C# break:
current_animation,assigned_animationandautoplayareStringName.
AnimationTree (use it for any character with more than ~3 states)
- Set
anim_playerand atree_root(AnimationNodeStateMachineorAnimationNodeBlendTree). The AnimationPlayer becomes a clip container only, so don't callplay()on it anymore. - Drive it through parameters (
anim_tree.set("parameters/…", v), oranim_tree["parameters/…"] = vin GDScript):- State machine:
var pb: AnimationNodeStateMachinePlayback = tree["parameters/playback"], thenpb.travel(&"Jump")(pathfinds through transitions),pb.start(&"Idle"),pb.get_current_node(). - Conditions on transitions:
parameters/conditions/is_grounded = true. Advance expressions: setadvance_expression_base_nodeand write expressions likevelocity.length() > 0.1. - Blend space:
parameters/Locomotion/blend_position = Vector2(x, y)(or a float for 1D). - One-shot:
parameters/Attack/request = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE. Transition node:parameters/State/transition_request = "crouch".
- State machine:
- 4.7: blend spaces use
sync_mode(SYNC_MODE_NONE,INDEPENDENT,CYCLIC_MUTABLE,CYCLIC_CONSTANT) instead of the oldsyncbool. Cyclic modes keep walk and run feet in phase. callback_mode_process: physics for gameplay-synced characters, idle for visuals. UseMANUAL+advance(delta)for deterministic or networked playback.