Struct blender_armature::InterpolationSettings[][src]

pub struct InterpolationSettings<'a> {
    pub current_time: f32,
    pub joint_indices: Vec<u8>,
    pub blend_fn: Option<fn(_: f32) -> f32>,
    pub current_action: ActionSettings<'a>,
    pub previous_action: Option<ActionSettings<'a>>,
}

Settings for how to interpolate your BlenderArmature's bone data. These can be used to do things such as:

  • Interpolate a walk animation to the lower body and a punch animation to the upper body
    • via joint_indices
  • Interpolate keyframes in slow motion
    • via slowly increasing the current_time

And more..

Fields

The current time will get compared to the start time of your current / previous animations. Bones will be interpolated based on the seconds elapsed. (current_time - {current_animation,start_animation}.start_time)

The joints that you want to interpolate. To interpolate the first, third and fourth bone you'd set this to vec![0, 2, 3].

To animate an entire armature you could pass in vec![0, 1, .., n - 1] where n is the number of bones in the armature. Usually via: blender_armature.bone_groups.get(BlenderArmature::BONE_GROUP_ALL).unwrap()

To only animate, say, the lower body, you'd pass in only the joint indices for the lower body. You'll typically get this vector via: blender_armature.bone_groups.get('lower_body').unwrap() assuming that you've created a lower_body bone group in Blender.

Your blend_fn returns a number between 0.0 and 1.0. This is used to control how quickly your previous_action blends into your current_action.

By default, of no blend_fn is specified, your previous_action will blend into your current_action linearly over 0.2s

0.0 means to source from your previous animation, 1.0 your current animation, and anything in between controls how much of your previous animation to use vs. your next.

If you supply a previous_animation your previous_action will be blended into your current_action using your blend_fn. ex:

// Blend previous_action into current_action linearly over 5 seconds
let blend_fn = |delta_seconds: f32| 0.2 * delta_seconds;

Settings for the current action (animation) of this armature.

Optional settings for the previous action of this armature. This is useful for blending the last animation that you were playing into the current one.

Auto Trait Implementations

impl<'a> Send for InterpolationSettings<'a>

impl<'a> Sync for InterpolationSettings<'a>