-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
index out of bounds : for animation_player, irregular bug #6204
Comments
would you have code to reproduce? maybe with the example many_foxes? |
This bug is irregular and does not always happen. I don't know how to exactly trigger it so I don't have code to reproduce. I can stop in the debugger automatically when the panic happens in vs code with lldb but I'm too noob to understand how to go up in the call stack and retrieve the variables such as the timestamps. I tried "rerun frame" in the debugger but the game just continues and stops at the break point without the error. |
I tried to use the many_fox example and play around with but wasn't successful in recreating the bug there. I played around with the set_elapsed and even used my own model but to no avail. |
I am able to reliably reproduce this bug in the fn keyboard_animation_control(
keyboard_input: Res<Input<KeyCode>>,
anims: Res<Animations>,
time: Res<Time>,
animations: Res<Assets<AnimationClip>>,
mut animation_player: Query<&mut AnimationPlayer>,
) {
if let Ok(mut player) = animation_player.get_single_mut() {
// Trigger the bug
if keyboard_input.just_pressed(KeyCode::Return) {
player.play(anims.0[0].clone_weak());
let duration = animations.get(&anims.0[0]).unwrap().duration();
let elapsed = duration - time.delta_seconds() * player.speed(); // align the planets
println!("duration {duration}, elapsed {elapsed}");
player.set_elapsed(elapsed);
}
}
} My understanding is that this can randomly occur, but it would be extremely rare. Notably, this requires |
Great and awesome! I now see that I forgot to turn off the repeat() when I tried to reproduce this. |
# Objective Fixes bevyengine#6204 ## Solution Added another branch to handle end-of-animation special case
# Objective Fixes bevyengine#6204 ## Solution Added another branch to handle end-of-animation special case
# Objective Fixes bevyengine#6204 ## Solution Added another branch to handle end-of-animation special case
# Objective Fixes bevyengine#6204 ## Solution Added another branch to handle end-of-animation special case
Bevy version
stable 0.8.0 release
What you did
Running a bunch of gltf animations. I change speed, animation clip very often.
What went wrong
I get the panic error at random but after a while of running my game.
One of my animations is 111 long but the error have occurred on other animations as well.
Error:
thread 'Compute Task Pool (4)' panicked at 'index out of bounds: the len is 111 but the index is 111', /home/pinkponk/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_animation-0.8.1/src/lib.rs:252:38
thread 'main' panicked at 'task has failed', /home/pinkponk/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-4.3.0/src/task.rs:426:45
Additional information
Bevy code, animation_player
discord help thread: https://discord.com/channels/691052431525675048/1019697973933899910/threads/1026824382418522162
The text was updated successfully, but these errors were encountered: