pub struct BoneMask {
pub weights: Vec<f32>,
}Expand description
Per-bone blend weights in [0.0, 1.0] used for partial-body animation layers.
A weight of 1.0 means the layer fully overrides that bone; 0.0 means
the bone is untouched.
Fields§
§weights: Vec<f32>Indexed by bone index (same order as Skeleton::bones).
Implementations§
Source§impl BoneMask
impl BoneMask
Sourcepub fn uniform(bone_count: usize, default_weight: f32) -> Self
pub fn uniform(bone_count: usize, default_weight: f32) -> Self
Create a mask with all weights set to default_weight.
Sourcepub fn upper_body(skeleton: &Skeleton) -> Self
pub fn upper_body(skeleton: &Skeleton) -> Self
Upper-body preset for a standard humanoid skeleton.
Sets bones named with “spine”, “chest”, “neck”, “head”, “shoulder”, “arm”, “hand”, “finger”, “clavicle” to weight 1.0; all others to 0.0.
Sourcepub fn lower_body(skeleton: &Skeleton) -> Self
pub fn lower_body(skeleton: &Skeleton) -> Self
Lower-body preset for a standard humanoid skeleton.
Sets bones named with “hip”, “pelvis”, “leg”, “knee”, “ankle”, “foot”, “toe” to weight 1.0; all others to 0.0.
Sourcepub fn set_weight(&mut self, id: BoneId, weight: f32)
pub fn set_weight(&mut self, id: BoneId, weight: f32)
Set the weight for a specific bone.
Sourcepub fn get_weight(&self, id: BoneId) -> f32
pub fn get_weight(&self, id: BoneId) -> f32
Get the weight for a specific bone.
Sourcepub fn union(&self, other: &BoneMask) -> Self
pub fn union(&self, other: &BoneMask) -> Self
Combine two masks by taking the maximum weight per bone.
Sourcepub fn intersection(&self, other: &BoneMask) -> Self
pub fn intersection(&self, other: &BoneMask) -> Self
Combine two masks by taking the minimum weight per bone.
Sourcepub fn from_pairs(bone_count: usize, pairs: &[(BoneId, f32)]) -> Self
pub fn from_pairs(bone_count: usize, pairs: &[(BoneId, f32)]) -> Self
Build a mask from an explicit list of (BoneId, weight) pairs.
Sourcepub fn from_bone_subtree(
skeleton: &Skeleton,
root_bones: &[BoneId],
weight: f32,
) -> Self
pub fn from_bone_subtree( skeleton: &Skeleton, root_bones: &[BoneId], weight: f32, ) -> Self
Build a mask where only the listed bones (and their children) are active.