Don't trigger animation events when paused (#15677)
# Objective Pausing the `animated_fox` example perfectly as one of the feet hits the ground causes the event to be triggered every frame. Context: #15538 ## Solution Don't trigger animation events if the animation is paused. ## Testing Ran the example, I no longer see the issue.
This commit is contained in:
parent
6edb78a8c3
commit
70269ef758
@ -1143,25 +1143,27 @@ pub fn animate_targets(
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Trigger all animation events that occurred this tick, if any.
|
if !active_animation.paused {
|
||||||
if let Some(triggered_events) = TriggeredEvents::from_animation(
|
// Trigger all animation events that occurred this tick, if any.
|
||||||
AnimationEventTarget::Node(target_id),
|
if let Some(triggered_events) = TriggeredEvents::from_animation(
|
||||||
clip,
|
AnimationEventTarget::Node(target_id),
|
||||||
active_animation,
|
clip,
|
||||||
) {
|
active_animation,
|
||||||
if !triggered_events.is_empty() {
|
) {
|
||||||
par_commands.command_scope(move |mut commands| {
|
if !triggered_events.is_empty() {
|
||||||
for TimedAnimationEvent { time, event } in
|
par_commands.command_scope(move |mut commands| {
|
||||||
triggered_events.iter()
|
for TimedAnimationEvent { time, event } in
|
||||||
{
|
triggered_events.iter()
|
||||||
commands.queue(trigger_animation_event(
|
{
|
||||||
entity,
|
commands.queue(trigger_animation_event(
|
||||||
*time,
|
entity,
|
||||||
active_animation.weight,
|
*time,
|
||||||
event.clone().0,
|
active_animation.weight,
|
||||||
));
|
event.clone().0,
|
||||||
}
|
));
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user