Skip to content

[Feature] Skeletal animation playback #161

@vmarcella

Description

@vmarcella

Overview

Add the ability to play animation clips on skeletons, animating bone transforms
over time.

Current State

No response

Scope

Goals:

  • Animation player component
  • Play/pause/stop controls
  • Playback speed control
  • Loop modes
  • Animation events (on loop, on finish)

Non-Goals:

  • Animation blending
  • Animation state machine
  • Root motion

Proposed API

pub struct SkeletalAnimationClip {
  bone_tracks: HashMap<usize, AnimationTrack<Transform>>,
  duration: f32,
}

pub struct AnimationPlayer {
  clip: Handle<SkeletalAnimationClip>,
  time: f32,
  speed: f32,
  playing: bool,
  looping: bool,
}

impl AnimationPlayer {
  pub fn new(clip: Handle<SkeletalAnimationClip>) -> Self;
  pub fn play(&mut self);
  pub fn pause(&mut self);
  pub fn stop(&mut self);
  pub fn set_speed(&mut self, speed: f32);
  pub fn set_looping(&mut self, looping: bool);
  pub fn update(&mut self, dt: f32);
  pub fn apply_to_pose(&self, clip: &SkeletalAnimationClip, pose: &mut Pose);
}

Acceptance Criteria

  • Animation plays at correct speed
  • Bone transforms update per frame
  • Looping restarts at end
  • Speed multiplier works (0.5x, 2x)
  • Pose reflects animation state

Affected Crates

lambda-rs

Notes

  • Track per bone index, not name (for speed)
  • Consider lazy pose computation

Metadata

Metadata

Assignees

No one assigned

    Labels

    animationAll things related to animationsenhancementNew feature or requestlambda-rsIssues pertaining to the core framework

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions