bevy-character-movement
БесплатноБез исполняемых скриптовНе проверенBevy 0.20 kinematic character movement: intent components, FixedUpdate integration, coyote time, and jump buffer. Use when a player or actor walks or jumps…
от thedivergentai★ 1 019 звёзд на GitHubОб этом скилле
Bevy character movement
When to use
Load this when a Bevy app needs a player or actor that moves in discrete steps (walk, jump feel, ground check) and you need the ECS shape before any solver code exists. Coyote time and a jump buffer are design notes. They are not a node port.
ECS shape
- Components own pose and intent: position, velocity, and a jump-buffer or coyote timer as data. The Quick Start ECS page shows components as Rust structs that derive
Component. - Resources own clocks and tuning shared by every mover.
bevy::time0.20.0 documentsTime,Fixed(fixed timestep clock), andVirtual. - Systems read intent and write velocity or position. Register them on the fixed schedule, not on a per-node physics callback.
- Schedule:
run_fixed_main_schedulerunsFixedMainfrom virtual time (bevy::time0.20.0). Order dependent systems with.chain()(ECS page). Do not paste a Godot physics-process function.
Engine counterparts
| Godot idea | Bevy idiom |
|---|---|
| Body that you move yourself | Entity with movement components and a system |
| Step that should stay stable when frame time changes | System on the fixed timestep (Fixed / FixedMain) |
| Coyote time, jump buffer | Timer data on the entity or a small resource, consumed by the movement system |
| Collision response | Collision response belongs on bevy-physics-3d. |
Scope
Locomotion here is kinematic data on FixedUpdate: intent, velocity, coyote time, and a jump buffer. Collision response belongs on bevy-physics-3d. Do not call move_and_slide, _physics_process, or CharacterBody2D.
[dependencies]
bevy = "0.20"
#[derive(Component, Default)]
struct PlanarIntent {
axis: Vec2,
jump_pressed: bool,
}
#[derive(Component)]
struct KinematicBody {
velocity: Vec3,
grounded: bool,
coyote: f32,
jump_buffer: f32,
}
#[derive(Resource)]
struct MoveTuning {
speed: f32,
jump_speed: f32,
gravity: f32,
coyote_time: f32,
jump_buffer_time: f32,
}
impl Default for MoveTuning {
fn default() -> Self {
Self {
speed: 6.0,
jump_speed: 8.0,
gravity: 20.0,
coyote_time: 0.12,
jump_buffer_time: 0.12,
}
}
}
fn read_move_intent(keys: Res<ButtonInput<KeyCode>>, mut bodies: Query<&mut PlanarIntent>) {
let mut axis = Vec2::ZERO;
if keys.pressed(KeyCode::KeyA) {
axis.x -= 1.0;
}
if keys.pressed(KeyCode::KeyD) {
axis.x += 1.0;
}
let jump_pressed = keys.just_pressed(KeyCode::Space);
for mut intent in &mut bodies {
intent.axis = axis;
intent.jump_pressed = jump_pressed;
}
}
fn step_kinematic(
time: Res<Time<Fixed>>,
tuning: Res<MoveTuning>,
mut bodies: Query<(&mut PlanarIntent, &mut KinematicBody, &mut Transform)>,
) {
let dt = time.delta_secs();
for (mut intent, mut body, mut transform) in &mut bodies {
body.velocity.x = intent.axis.x * tuning.speed;
if body.grounded {
body.coyote = tuning.coyote_time;
} else {
body.coyote = (body.coyote - dt).max(0.0);
body.velocity.y -= tuning.gravity * dt;
}
if intent.jump_pressed {
body.jump_buffer = tuning.jump_buffer_time;
intent.jump_pressed = false;
} else {
body.jump_buffer = (body.jump_buffer - dt).max(0.0);
}
if body.jump_buffer > 0.0 && body.coyote > 0.0 {
body.velocity.y = tuning.jump_speed;
body.jump_buffer = 0.0;
body.coyote = 0.0;
body.grounded = false;
}
transform.translation += body.velocity * dt;
if transform.translation.y <= 0.0 {
transform.translation.y = 0.0;
body.velocity.y = 0.0;
body.grounded = true;
}
}
}
fn spawn_mover(mut commands: Commands) {
commands.spawn((
Transform::default(),
PlanarIntent::default(),
KinematicBody {
velocity: Vec3::ZERO,
grounded: true,
coyote: 0.0,
jump_buffer: 0.0,
},
));
}
pub struct CharacterMovementPlugin;
impl Plugin for CharacterMovementPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<MoveTuning>()
.add_systems(Startup, spawn_mover)
.add_systems(Update, read_move_intent)
.add_systems(FixedUpdate, step_kinematic);
}
}
Sample ButtonInput::just_pressed in Update. FixedUpdate can run zero times or several times in one frame, so a press read there is dropped or repeated. The intent component keeps the edge until FixedUpdate consumes it.
When a physics skill writes Grounded, chain the coyote refill after that write so the timer sees the contact from the same tick.
#[derive(Component)]
struct Grounded;
#[derive(Component)]
struct CoyoteTimer(f32);
#[derive(Resource)]
struct C
Установить bevy-character-movement в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл bevy-character-movement?
Bevy 0.20 kinematic character movement: intent components, FixedUpdate integration, coyote time, and jump buffer. Use when a player or actor walks or jumps and the step must stay stable. Keywords: Bevy, movement, FixedUpdate, coyote, jump buffer, ECS.
Как установить скилл bevy-character-movement?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bevy-character-movement запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic