animation-patterns
БесплатноБез исполняемых скриптовНе проверенAnimation code patterns: Godot BlendSpace2D locomotion, AnimationNodeStateMachine transitions, root motion integration, IK foot planting, call-method…
от HermeticOrmus★ 83 звезды на GitHubОб этом скилле
Animation Patterns
Godot AnimationTree BlendSpace2D Locomotion
# Locomotion blend tree setup - driven by velocity
class_name PlayerAnimator extends Node
@onready var animation_tree: AnimationTree = $AnimationTree
@onready var body: CharacterBody3D = get_parent()
const BLEND_PATH := "parameters/LocomotionBlend/blend_position"
const SPEED_PATH := "parameters/SpeedBlend/blend_amount"
func _physics_process(_delta: float) -> void:
var velocity := body.velocity
var speed := velocity.length()
# 2D blend space: X=strafe (-1 left, 1 right), Y=forward (0 idle, 1 run)
# Normalize by max speed so blend space uses [0,1] range
var horizontal := body.global_transform.basis.x.dot(velocity) / 6.0
var forward := -body.global_transform.basis.z.dot(velocity) / 6.0
animation_tree.set(BLEND_PATH, Vector2(horizontal, forward))
animation_tree.set(SPEED_PATH, speed / 6.0) # 6.0 = max run speed
# AnimationTree configuration (in Godot editor):
# Root: AnimationNodeStateMachine
# State "Locomotion": AnimationNodeBlendSpace2D
# Points:
# (0, 0) = "idle" clip
# (0, 1) = "run_forward" clip
# (1, 0) = "strafe_right" clip
# (-1, 0) = "strafe_left" clip
# (0, -1) = "walk_backward" clip
# Blend mode: Interpolation (linear)
# State "Jump": AnimationNodeAnimation ("jump" clip, no loop)
# State "Land": AnimationNodeAnimation ("land" clip, no loop)
# Transitions:
# Locomotion -> Jump: condition "is_jumping" (bool param)
# Jump -> Land: advance condition "animation_finished"
# Land -> Locomotion: advance condition "animation_finished"
AnimationNodeStateMachine Transitions (GDScript)
# Trigger state transitions through AnimationTree parameters
func jump() -> void:
animation_tree.set("parameters/conditions/is_jumping", true)
# Reset after one frame so it acts as a trigger
await get_tree().process_frame
animation_tree.set("parameters/conditions/is_jumping", false)
func land() -> void:
animation_tree.set("parameters/conditions/is_landing", true)
await get_tree().process_frame
animation_tree.set("parameters/conditions/is_landing", false)
# Reading current state name for logic decisions
func get_current_animation() -> StringName:
var playback: AnimationNodeStateMachinePlayback = animation_tree.get(
"parameters/playback"
)
return playback.get_current_node()
func is_in_state(state_name: StringName) -> bool:
return get_current_animation() == state_name
Root Motion Integration
# Apply AnimationTree root motion to CharacterBody3D
class_name RootMotionCharacter extends CharacterBody3D
@onready var animation_tree: AnimationTree = $AnimationTree
func _physics_process(delta: float) -> void:
# Get root motion delta from animation (in local space)
var root_motion: Vector3 = animation_tree.get_root_motion_position()
# Transform from local animation space to world space
var world_motion: Vector3 = global_transform.basis * root_motion
# Apply gravity separately (root motion only handles horizontal locomotion)
if not is_on_floor():
velocity.y -= 9.8 * delta
else:
velocity.y = 0.0
# Override XZ velocity with root motion
velocity.x = world_motion.x / delta
velocity.z = world_motion.z / delta
move_and_slide()
Inverse Kinematics - Foot Planting
# Foot IK using SkeletonIK3D nodes
class_name FootIK extends Node
@export var skeleton: Skeleton3D
@export var left_ik: SkeletonIK3D
@export var right_ik: SkeletonIK3D
@export var raycast_distance: float = 1.5
@export var ik_blend_speed: float = 10.0
var _left_ik_weight: float = 0.0
var _right_ik_weight: float = 0.0
func _physics_process(delta: float) -> void:
_update_foot_ik(left_ik, "LeftFoot", delta, _left_ik_weight)
_update_foot_ik(right_ik, "RightFoot", delta, _right_ik_weight)
func _update_foot_ik(ik: SkeletonIK3D, bone_name: String, delta: float, weight: float) -> void:
var bone_idx := skeleton.find_bone(bone_name)
var bone_global_pos := skeleton.get_bone_global_pose(bone_idx).origin
bone_global_pos = skeleton.global_transform * bone_global_pos
var space_state := get_world_3d().direct_space_state
var query := PhysicsRayQueryParameters3D.create(
bone_global_pos + Vector3.UP * 0.5,
bone_global_pos + Vector3.DOWN * raycast_distance,
0b0001 # ground layer only
)
var result := space_state.intersect_ray(query)
if result:
# Align IK target to ground surface
var target_xform := Transform3D(
Basis(result.normal), # orient to slope
result.position
)
ik.target = target_xform
_left_ik_weight = move_toward(_left_ik_weight, 1.0, delta * ik_blend_speed)
else:
_left_ik_weight = move_toward(_left_ik_weight, 0.0, delta * ik_blend_speed)
ik.interpolation = _left_ik_weight
Animation Events via
Установить animation-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл animation-patterns?
Animation code patterns: Godot BlendSpace2D locomotion, AnimationNodeStateMachine transitions, root motion integration, IK foot planting, call-method animation events, and a Unity 2D freeform blend tree. Use when implementing character locomotion, animation state logic, or IK in a game.
Как установить скилл animation-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл animation-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic