Function blend_pose_into

Source
pub fn blend_pose_into(
    base: &[Transform],
    layer: &[Transform],
    weight: f32,
    mask: Option<&JointMask>,
    out: &mut [Transform],
) -> Result<(), AnimationError>
Expand description

Blend local TRS values using shortest-arc normalized quaternion interpolation. Allocation-free; malformed lengths, poses or weights leave output unchanged. A joint with zero effective weight retains its exact base transform, including its quaternion magnitude. All inputs are validated even for excluded joints.

use ferravex_play::{animation::{blend_pose_into, JointMask}, scene::Transform};
let base = [Transform::default(); 2];
let layer = [Transform { translation: [8., 0., 0.], ..base[0] }; 2];
let mask = JointMask::new(vec![0., 0.5])?;
let mut out = base;
blend_pose_into(&base, &layer, 0.5, Some(&mask), &mut out)?;
assert_eq!(out[0], base[0]);
assert_eq!(out[1].translation[0], 2.);