Byte Engine Docs
View on docs.rs

root_motion

Generated Rust API reference for byte_engine.

byte_engine / animation / root_motion


Module root_motion

Root-motion extraction and composition utilities.

Quick Reference

ItemKindDescription
RootMotionDeltastructThe RootMotionDelta struct carries one frame's local translation and rotation change to gameplay.
RootMotionErrorenumErrors returned when root motion cannot be extracted from a pose pair.
extract_root_motionfnExtracts one root node's motion and resets its translation and rotation to a reference pose.
forward_loop_root_motionfnCalculates a forward loop-wrap delta by joining the end and start segments.

Structs

RootMotionDelta

struct RootMotionDelta {
    pub translation: [f32; 3],
    pub rotation: [f32; 4],
}

Defined in crates/byte-engine/src/animation/root_motion.rs:9-14

The RootMotionDelta struct carries one frame's local translation and rotation change to gameplay.

Fields

  • translation: [f32; 3]

    Translation to apply in the skeleton root's parent space.

  • rotation: [f32; 4]

    Rotation to apply after the previous root rotation.

Implementations

  • const IDENTITY: Self
  • fn between(previous: LocalTransform, current: LocalTransform) -> Self

    Calculates the shortest local transform delta between two sampled root poses.

  • fn then(self, next: Self) -> Self

    Composes this delta followed by next.

    Translation remains in the skeleton root's parent space, so segment

    translations add directly. Use this to join root-motion segments across

    a looping clip boundary.

  • fn blend(self, other: Self, factor: f32) -> Self

    Blends two root-motion deltas for pose blending.

Trait Implementations

impl ArchivePointee for RootMotionDelta
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for RootMotionDelta
impl Clone for RootMotionDelta
impl Copy for RootMotionDelta
impl Debug for RootMotionDelta
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Default for RootMotionDelta
  • fn default() -> Self
impl Downcast for RootMotionDelta
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for RootMotionDelta
  • fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for RootMotionDelta
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Instrument for RootMotionDelta
impl LayoutRaw for RootMotionDelta
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for RootMotionDelta
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for RootMotionDelta
impl Pointable for RootMotionDelta
  • const ALIGN: usize
  • type Init = T
  • unsafe fn init(init: <T as Pointable>::Init) -> usize
  • unsafe fn deref<'a>(ptr: usize) -> &'a T
  • unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
  • unsafe fn drop(ptr: usize)
impl Pointee for RootMotionDelta
  • type Metadata = ()
impl Read for RootMotionDelta
impl<R> ReadPrimitive for RootMotionDelta
impl StructuralPartialEq for RootMotionDelta
impl WithSubscriber for RootMotionDelta

Enums

RootMotionError

enum RootMotionError {
    PoseLength {
        previous: usize,
        current: usize,
    },
    RootNodeOutOfRange {
        root_node: usize,
        pose_len: usize,
    },
}

Defined in crates/byte-engine/src/animation/root_motion.rs:107-122

Errors returned when root motion cannot be extracted from a pose pair.

Variants

  • PoseLength

    The previous and current poses have different node counts.

  • RootNodeOutOfRange

    The selected root node is outside the pose.

Trait Implementations

impl ArchivePointee for RootMotionError
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for RootMotionError
impl Clone for RootMotionError
impl Copy for RootMotionError
impl Debug for RootMotionError
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Display for RootMotionError
  • fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
impl Downcast for RootMotionError
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for RootMotionError
  • fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for RootMotionError
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Eq for RootMotionError
impl<K> Equivalent for RootMotionError
  • fn equivalent(&self, key: &K) -> bool
impl Error for RootMotionError
impl Instrument for RootMotionError
impl LayoutRaw for RootMotionError
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for RootMotionError
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for RootMotionError
impl Pointable for RootMotionError
  • const ALIGN: usize
  • type Init = T
  • unsafe fn init(init: <T as Pointable>::Init) -> usize
  • unsafe fn deref<'a>(ptr: usize) -> &'a T
  • unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
  • unsafe fn drop(ptr: usize)
impl Pointee for RootMotionError
  • type Metadata = ()
impl Read for RootMotionError
impl StructuralPartialEq for RootMotionError
impl ToString for RootMotionError
  • fn to_string(&self) -> String
impl WithSubscriber for RootMotionError

Functions

extract_root_motion

fn extract_root_motion(previous_pose: &[resource_management::resources::skeleton::LocalTransform], current_pose: &mut [resource_management::resources::skeleton::LocalTransform], root_node: usize, reference: resource_management::resources::skeleton::LocalTransform) -> Result<RootMotionDelta, RootMotionError>

Defined in crates/byte-engine/src/animation/root_motion.rs:65-93

Extracts one root node's motion and resets its translation and rotation to a reference pose.

Keep previous_pose unmodified between frames. The current root keeps its sampled scale because scale is not locomotion.

forward_loop_root_motion

fn forward_loop_root_motion(previous: resource_management::resources::skeleton::LocalTransform, loop_end: resource_management::resources::skeleton::LocalTransform, loop_start: resource_management::resources::skeleton::LocalTransform, current: resource_management::resources::skeleton::LocalTransform) -> RootMotionDelta

Defined in crates/byte-engine/src/animation/root_motion.rs:96-103

Calculates a forward loop-wrap delta by joining the end and start segments.

On this page

Module root_motionQuick ReferenceStructsRootMotionDeltaFieldsImplementationsTrait Implementationsimpl ArchivePointee for RootMotionDeltaimpl<ST> CastableFrom for RootMotionDeltaimpl Clone for RootMotionDeltaimpl Copy for RootMotionDeltaimpl Debug for RootMotionDeltaimpl Default for RootMotionDeltaimpl Downcast for RootMotionDeltaimpl DowncastSend for RootMotionDeltaimpl DowncastSync for RootMotionDeltaimpl Instrument for RootMotionDeltaimpl LayoutRaw for RootMotionDeltaimpl<T, N1> Niching for RootMotionDeltaimpl PartialEq for RootMotionDeltaimpl Pointable for RootMotionDeltaimpl Pointee for RootMotionDeltaimpl Read for RootMotionDeltaimpl<R> ReadPrimitive for RootMotionDeltaimpl StructuralPartialEq for RootMotionDeltaimpl WithSubscriber for RootMotionDeltaEnumsRootMotionErrorVariantsTrait Implementationsimpl ArchivePointee for RootMotionErrorimpl<ST> CastableFrom for RootMotionErrorimpl Clone for RootMotionErrorimpl Copy for RootMotionErrorimpl Debug for RootMotionErrorimpl Display for RootMotionErrorimpl Downcast for RootMotionErrorimpl DowncastSend for RootMotionErrorimpl DowncastSync for RootMotionErrorimpl Eq for RootMotionErrorimpl<K> Equivalent for RootMotionErrorimpl Error for RootMotionErrorimpl Instrument for RootMotionErrorimpl LayoutRaw for RootMotionErrorimpl<T, N1> Niching for RootMotionErrorimpl PartialEq for RootMotionErrorimpl Pointable for RootMotionErrorimpl Pointee for RootMotionErrorimpl Read for RootMotionErrorimpl StructuralPartialEq for RootMotionErrorimpl ToString for RootMotionErrorimpl WithSubscriber for RootMotionErrorFunctionsextract_root_motionforward_loop_root_motion