diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index 010fc92887..1989516334 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -218,6 +218,18 @@ pub fn animation_player( } if let Ok(mut transform) = transforms.get_mut(current_entity) { for curve in curves { + // Some curves have only one keyframe used to set a transform + if curve.keyframe_timestamps.len() == 1 { + match &curve.keyframes { + Keyframes::Rotation(keyframes) => transform.rotation = keyframes[0], + Keyframes::Translation(keyframes) => { + transform.translation = keyframes[0] + } + Keyframes::Scale(keyframes) => transform.scale = keyframes[0], + } + continue; + } + // Find the current keyframe // PERF: finding the current keyframe can be optimised let step_start = match curve