Skip to main content

concinnity_core/components/
root_motion_event.rs

1// src/components/root_motion_event.rs
2
3use crate::ecs::SkinnedMeshHandle;
4
5/// Per-frame character displacement extracted from root-motion clips.
6///
7/// `AnimationSystem` publishes one event per animated target whose active
8/// clips carry a baked root track, holding the frame's blended displacement
9/// in the mesh's local space (unrotated, unscaled). Consumers -- the
10/// `CharacterRig` capsule drive in `PhysicsSystem` -- map it through the
11/// mesh's model transform and move the character. Events, not components:
12/// a missed frame must not accumulate.
13#[derive(Debug, Clone, Copy)]
14pub struct RootMotionEvent {
15    /// The `SkinnedMesh` resource whose animation produced the displacement.
16    pub target: SkinnedMeshHandle,
17    /// Displacement in the mesh's local space for this frame.
18    pub delta: [f32; 3],
19}