Using AnimationPlayer::seek_to – is this a bug, or am I using it wrong? #11159
-
Hello, I was trying to debug an animation issue on a project of mine, initially thought it might be fixed by the 0.12.1 animation changes, but now I'm not sure. I tried a minimal reproduction using the First case (play animation to end)diff --git a/examples/animation/animated_transform.rs b/examples/animation/animated_transform.rs
index 0a3aa0239..4246c659a 100644
--- a/examples/animation/animated_transform.rs
+++ b/examples/animation/animated_transform.rs
@@ -109,11 +109,11 @@ fn setup(
},
);
// Create the animation player, and set it to repeat
let mut player = AnimationPlayer::default();
- player.play(animations.add(animation)).repeat();
+ player.play(animations.add(animation));
// Create the scene that will be animated
// First entity is the planet
commands
.spawn(( Second case (seek to end of clip)Second case: diff --git a/examples/animation/animated_transform.rs b/examples/animation/animated_transform.rs
index 0a3aa0239..f6e8b456e 100644
--- a/examples/animation/animated_transform.rs
+++ b/examples/animation/animated_transform.rs
@@ -109,11 +109,12 @@ fn setup(
},
);
// Create the animation player, and set it to repeat
let mut player = AnimationPlayer::default();
- player.play(animations.add(animation)).repeat();
+ let duration = animation.duration();
+ player.play(animations.add(animation)).seek_to(duration);
// Create the scene that will be animated
// First entity is the planet
commands
.spawn(( Am I missing something about how this API is supposed to work, or is this something that could be considered a bug? If so, is there some way I can work around it so that the objects are spawned as if they had played their animations to completion? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think this might be related to #10832 |
Beta Was this translation helpful? Give feedback.
I think this might be related to #10832