-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Panic on unreachable code on 2 rigidbodies with CCD intersecting with a bigger trimesh collider #386
Comments
Can reproduce on my Windows 10 machine. Full console outputRunning `target\debug\bevydebug.exe` 2023-06-25T09:53:21.838114Z INFO bevy_winit::system: Creating new window "Bevy App" (0v0) 2023-06-25T09:53:23.866498Z INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 2060", vendor: 4318, device: 7817, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "527.56", backend: Vulkan } 2023-06-25T09:53:24.966677Z INFO bevy_rapier3d::render::lines: Loaded 3d debug lines plugin. 2023-06-25T09:53:25.374842Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 10 Pro", kernel: "19045", cpu: "AMD Ryzen 5 1600 Six-Core Processor", core_count: "6", memory: "15.9 GiB" } thread 'Compute Task Pool (0)' panicked at 'internal error: entered unreachable code', C:\Users\frep\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.13.4\src\query\nonlinear_time_of_impact\nonlinear_time_of_impact_support_map_support_map.rs:201:40 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'Compute Task Pool (0)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', C:\Users\frep\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.10.1\src\schedule\executor\multi_threaded.rs:194:60 thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', C:\Users\frep\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_tasks-0.10.1\src\task_pool.rs:376:49 error: process didn't exit successfully: `target\debug\bevydebug.exe` (exit code: 101) |
Seems to also happen on the current git versions of both Rapier and this plugin.
Cargo.toml
Cargo.lock
|
The same 😢 on mac |
Same for me too, using AsyncSceneCollider with TriMesh (no CCD enabled) and a capsule collider (CCD enabled). Edit: Changing the computed collider type to ConvexHull fixes the issue. |
The Parry issue is here: dimforge/parry#176 I wrote up some potential reasons for the core problem there. We mainly just need someone to find where |
I converted @Architector4 's example to Bevy 0.13 and bevy_rapier 0.26 and it no longer panics but instead spams this error a bunch of times after clicking the mouse:
main.rsuse bevy::prelude::*;
use bevy_rapier3d::prelude::*;
fn spawn_dynamic(mut commands: Commands, input_mouse: Res<ButtonInput<MouseButton>>) {
if input_mouse.pressed(MouseButton::Left) {
commands.spawn((
RigidBody::Dynamic,
Ccd { enabled: true },
Collider::cuboid(0.5, 0.5, 0.5),
));
}
}
fn setup(mut commands: Commands) {
let some_mesh: Mesh = Cuboid::default().into();
let collider = Collider::from_bevy_mesh(&some_mesh, &ComputedColliderShape::TriMesh).unwrap();
commands.spawn(Camera3dBundle {
transform: Transform {
translation: Vec3::new(0.0, 10.0, 10.0),
rotation: Quat::from_rotation_x(-0.8),
..default()
},
..default()
});
commands.spawn((
collider,
SpatialBundle {
transform: Transform {
scale: Vec3 {
x: 1.1,
y: 1.0,
z: 1.0,
},
..default()
},
..default()
},
));
}
pub fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(RapierDebugRenderPlugin::default())
.add_plugins(RapierPhysicsPlugin::<NoUserData>::default())
.add_systems(Startup, setup)
.add_systems(Update, spawn_dynamic)
.run();
} Cargo.toml[package]
name = "bevy_rapier_bug_test"
version = "0.1.0"
edition = "2021"
[dependencies]
bevy = { version = "0.13.2", features=["wayland"] }
bevy_rapier3d = "0.26.0"
It does keep running with no apparent problems outside of the error logs. The boxes do fly off (from being inside each other?). It's unclear if there are any undesired side effects though. |
I decided to try enabling CCD on some dynamic rigid bodies in a project, and immediately noticed crashes on unreachable code. The error seems to originate from Parry, but I'm unfamiliar with neither raw Parry nor Rapier, and can only provide example code as a Bevy project, so I feel like it's better if I post this issue here.
It seems to happen with the latest
bevy
andbevy_rapier3d
crates on latest versions as of now, with default features compiled from a fresh new crate (seeCargo.toml
below for exact versions).Trying this on Arch Linux on Intel i5-8250U CPU on rustc 1.70.0.
Here's an example project; click twice to immediately crash the application:
Cargo.toml
src/main.rs
From experimentation, it appears that this specifically happens when there is a static rigid body with a computed collider from a mesh (using
Collider
type's presets likecuboid
don't seem to cause the crash, it has to be a trimesh) and 2 dynamic rigid bodies with any type of collider but with CCD on (even with default of 1 substep) that are smaller than the static one are found to be all intersecting with each other.I haven't tested them intersecting in any other configuration than all 3 bodies at once. Any collider shapes and types seem to work, as long as one of the bodies is a trimesh collider that is bigger than the rest (it can also be a dynamic rigid body, though then it can get a bit harder to reproduce the issue, with disabling gravity and more clicks needed).
The text was updated successfully, but these errors were encountered: