pub struct Skeleton2D {
pub bones: Vec<Bone2D>,
pub world_transforms: Vec<BoneTransform>,
}Expand description
Hierarchical bone skeleton attached as an ECS component.
Contains the bone definitions and their computed world-space transforms.
The update_skeletal_animations
system keeps world_transforms up to date each frame.
Fields§
§bones: Vec<Bone2D>Ordered list of bones (parents appear before children).
world_transforms: Vec<BoneTransform>World-space transforms computed by hierarchy propagation.
Implementations§
Source§impl Skeleton2D
impl Skeleton2D
Sourcepub fn new(bones: Vec<Bone2D>) -> Skeleton2D
pub fn new(bones: Vec<Bone2D>) -> Skeleton2D
Creates a new skeleton and computes initial world transforms.
Bones must be ordered so that every parent appears before its children.
Invalid parent_id values (out of range or forward references) are
treated as root bones.
Sourcepub fn bone_count(&self) -> usize
pub fn bone_count(&self) -> usize
Returns the number of bones.
Trait Implementations§
Source§impl Clone for Skeleton2D
impl Clone for Skeleton2D
Source§fn clone(&self) -> Skeleton2D
fn clone(&self) -> Skeleton2D
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Skeleton2D
impl Debug for Skeleton2D
impl Component for Skeleton2D
Auto Trait Implementations§
impl Freeze for Skeleton2D
impl RefUnwindSafe for Skeleton2D
impl Send for Skeleton2D
impl Sync for Skeleton2D
impl Unpin for Skeleton2D
impl UnsafeUnpin for Skeleton2D
impl UnwindSafe for Skeleton2D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more