Closed paul-hansen closed 5 months ago
I think there's a regression in rapier 0.21. Getting this error for the first time now in an otherwise unchanged codebase (other than upgrading to Bevy 0.10) Interestingly, it only happens on Wasm and not native.
Just tried this again to see if anything has changed with the new versions and the example I provided still consistently panics, hitting this unreachable!()
line.
Here's an updated example:
[dependencies]
bevy = "0.10.0"
bevy_rapier3d = "0.21.0"
use bevy::prelude::*;
use bevy_rapier3d::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(RapierPhysicsPlugin::<NoUserData>::default())
.add_startup_system(setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn((
TransformBundle::from_transform(
Transform::from_xyz(0.0, 0.0, 20.0)
// Commenting out this line it no longer panics
.with_scale(Vec3::splat(2.0)),
),
// If you use a different collider that isn't a bevy mesh here it no longer panics
Collider::from_bevy_mesh(
&Mesh::from(shape::Cube { size: 3.0 }),
&ComputedColliderShape::TriMesh,
)
.unwrap(),
RigidBody::Fixed,
));
commands.spawn((
Collider::ball(1.0),
RigidBody::Dynamic,
// Commenting out this line it no longer panics
// Ccd::enabled(),
Velocity::linear(Vec3::Z * 10000.0),
));
}
As for me, my code magically works now. Strange 🤷♂️
Also ran into this same issue.
It only happens when i use ComputedColliderShape::TriMesh, if i switch to ComputedColliderShape::ConvexDecomposition(VHACDParameters::default()), it stops
Have the same issue with CCD and TriMesh (and WASM):
bevy = "0.13.0" bevy_rapier3d = { version = "0.25.0", features = [ "enhanced-determinism", "debug-render-3d", "wasm-bindgen", "serde-serialize" ] }
parry3d-0.13.6/src/query/nonlinear_time_of_impact/nonlinear_time_of_impact_support_map_support_map.rs:201:40:
internal error: entered unreachable code
Recent duplicate here: https://github.com/dimforge/bevy_rapier/issues/386
Updated example for bevy 0.13 and bevy_rapier3d 0.26 no longer panics but returns the error:
ERROR log: Closest points not found despite setting the max distance to infinity.
Description
I'm getting a panic when two objects collide if one has a collider created using
from_bevy_mesh
and the entity has a scaled transform and the other object has ccd enabled.Click for full traceback
``` thread 'main' panicked at 'internal error: entered unreachable code', C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.9.0\src\query\nonlinear_time_of_impact\nonlinear_time_of_impact_support_map_support_map.rs:201:40 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library\std\src\panicking.rs:584 1: core::panicking::panic_fmt at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library\core\src\panicking.rs:142 2: core::panicking::panic at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library\core\src\panicking.rs:48 3: parry3d::query::nonlinear_time_of_impact::nonlinear_time_of_impact_support_map_support_map::compute_toiMy use case is I have an asteroid field that has randomly placed asteroids with random scales. I have a custom collider mesh for the asteroids and I want my bullets that shoot the asteroids to use ccd so they don't go through the asteroids.
System
Windows 11 Bevy 0.8 bevy_rapier3d 0.16 (also main branch)
Minimal reproduction
This code demonstrates the error, it creates a fixed rigid body using a bevy mesh as a collider and a transform scaled to 2X, then creates a dynamic rigid body with ccd enabled and sends it at it with a high velocity.