pub struct MotionPlayer { /* private fields */ }Expand description
Plays a parsed motion3.json animation against a ModelRuntime.
A player owns playback time and blend weight. It does not update meshes by
itself; call ModelRuntime::update_meshes after applying one or more
players.
Implementations§
Source§impl MotionPlayer
impl MotionPlayer
Sourcepub fn new(motion: Motion3) -> Self
pub fn new(motion: Motion3) -> Self
Creates a player at time 0.0 with full weight.
The player follows the motion’s own Loop metadata.
Sourcepub fn new_once(motion: Motion3) -> Self
pub fn new_once(motion: Motion3) -> Self
Creates a player that stops at the end, ignoring the motion’s Loop metadata.
Sourcepub fn with_looping(motion: Motion3, looping: bool) -> Self
pub fn with_looping(motion: Motion3, looping: bool) -> Self
Creates a player with an explicit loop mode.
Sourcepub fn is_looping(&self) -> bool
pub fn is_looping(&self) -> bool
Returns whether this player wraps at the motion duration.
Sourcepub fn set_weight(&mut self, weight: f32)
pub fn set_weight(&mut self, weight: f32)
Sets the player’s global blend weight, clamped to 0.0..=1.0.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Returns whether a one-shot motion has reached its end.
Sourcepub fn tick(&mut self, delta_seconds: f32)
pub fn tick(&mut self, delta_seconds: f32)
Advances playback time by delta_seconds.
Negative deltas are treated as zero. Looping motions wrap at their declared duration; non-looping motions stop at the end.
Sourcepub fn apply(&self, runtime: &mut ModelRuntime)
pub fn apply(&self, runtime: &mut ModelRuntime)
Applies the current motion sample to a model runtime.
Curves targeting unknown parameters or parts are ignored. Call
ModelRuntime::update_meshes after all motion and expression players
have been applied for the frame.
Trait Implementations§
Source§impl Clone for MotionPlayer
impl Clone for MotionPlayer
Source§fn clone(&self) -> MotionPlayer
fn clone(&self) -> MotionPlayer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more