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
| Item | Kind | Description |
|---|---|---|
RootMotionDelta | struct | The RootMotionDelta struct carries one frame's local translation and rotation change to gameplay. |
RootMotionError | enum | Errors returned when root motion cannot be extracted from a pose pair. |
extract_root_motion | fn | Extracts one root node's motion and resets its translation and rotation to a reference pose. |
forward_loop_root_motion | fn | Calculates 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) -> SelfCalculates the shortest local transform delta between two sampled root poses.
-
fn then(self, next: Self) -> SelfComposes 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) -> SelfBlends 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
-
fn clone(&self) -> RootMotionDeltaRelated:
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
-
fn eq(&self, other: &RootMotionDelta) -> boolRelated:
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
-
PoseLengthThe previous and current poses have different node counts.
-
RootNodeOutOfRangeThe 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
-
fn clone(&self) -> RootMotionErrorRelated:
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
-
fn eq(&self, other: &RootMotionError) -> boolRelated:
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) -> RootMotionDeltaDefined in crates/byte-engine/src/animation/root_motion.rs:96-103
Calculates a forward loop-wrap delta by joining the end and start segments.