bevy_rapier icon indicating copy to clipboard operation
bevy_rapier copied to clipboard

Panic when using a bevy mesh as a collider, ccd enabled and scaled transform

Open paul-hansen opened this issue 3 years ago • 5 comments

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.

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
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_toi<parry3d::query::default_query_dispatcher::DefaultQueryDispatcher,parry3d::shape::ball::Ball,parry3d::shape::ball::Ball>
             at 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
   4: parry3d::query::nonlinear_time_of_impact::nonlinear_time_of_impact_support_map_support_map::nonlinear_time_of_impact_support_map_support_map<parry3d::query::default_query_dispatcher::DefaultQueryDispatcher,parry3d::shape::ball::Ball,parry3d::shape::ball::
             at 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:81
   5: parry3d::query::nonlinear_time_of_impact::nonlinear_time_of_impact_composite_shape_shape::impl$1::visit<parry3d::query::default_query_dispatcher::DefaultQueryDispatcher,dyn$<parry3d::shape::composite_shape::SimdCompositeShape> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.9.0\src\query\nonlinear_time_of_impact\nonlinear_time_of_impact_composite_shape_shape.rs:142
   6: parry3d::partitioning::qbvh::qbvh::QBVH<u32>::traverse_best_first<u32,parry3d::query::nonlinear_time_of_impact::nonlinear_time_of_impact_composite_shape_shape::NonlinearTOICompositeShapeShapeBestFirstVisitor<parry3d::query::default_query_dispatcher::Defau
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.9.0\src\partitioning\qbvh\traversal.rs:101
   7: parry3d::query::nonlinear_time_of_impact::nonlinear_time_of_impact_composite_shape_shape::nonlinear_time_of_impact_composite_shape_shape<parry3d::query::default_query_dispatcher::DefaultQueryDispatcher,dyn$<parry3d::shape::composite_shape::SimdCompositeSh
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.9.0\src\query\nonlinear_time_of_impact\nonlinear_time_of_impact_composite_shape_shape.rs:34
   8: parry3d::query::nonlinear_time_of_impact::nonlinear_time_of_impact_composite_shape_shape::nonlinear_time_of_impact_shape_composite_shape<parry3d::query::default_query_dispatcher::DefaultQueryDispatcher,dyn$<parry3d::shape::composite_shape::SimdCompositeSh
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.9.0\src\query\nonlinear_time_of_impact\nonlinear_time_of_impact_composite_shape_shape.rs:54
   9: parry3d::query::default_query_dispatcher::impl$0::nonlinear_time_of_impact
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.9.0\src\query\default_query_dispatcher.rs:379
  10: rapier3d::dynamics::ccd::toi_entry::TOIEntry::try_from_colliders<dyn$<parry3d::query::query_dispatcher::QueryDispatcher> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\rapier3d-0.14.0\src\dynamics\ccd\toi_entry.rs:131
  11: rapier3d::dynamics::ccd::ccd_solver::impl$1::predict_impacts_at_next_positions::closure$0
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\rapier3d-0.14.0\src\dynamics\ccd\ccd_solver.rs:319
  12: core::ops::function::impls::impl$3::call_mut<tuple$<ref$<rapier3d::geometry::collider_components::ColliderHandle> >,rapier3d::dynamics::ccd::ccd_solver::impl$1::predict_impacts_at_next_positions::closure_env$0>
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\ops\function.rs:290
  13: parry3d::query::visitors::bounding_volume_intersections_visitor::impl$1::visit<rapier3d::geometry::collider_components::ColliderHandle,ref_mut$<rapier3d::dynamics::ccd::ccd_solver::impl$1::predict_impacts_at_next_positions::closure_env$0> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.9.0\src\query\visitors\bounding_volume_intersections_visitor.rs:42
  14: parry3d::partitioning::qbvh::qbvh::QBVH<rapier3d::geometry::collider_components::ColliderHandle>::traverse_depth_first_with_stack<rapier3d::geometry::collider_components::ColliderHandle,parry3d::query::visitors::bounding_volume_intersections_visitor::Boun
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.9.0\src\partitioning\qbvh\traversal.rs:43
  15: parry3d::partitioning::qbvh::qbvh::QBVH<rapier3d::geometry::collider_components::ColliderHandle>::traverse_depth_first<rapier3d::geometry::collider_components::ColliderHandle,parry3d::query::visitors::bounding_volume_intersections_visitor::BoundingVolumeI
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\parry3d-0.9.0\src\partitioning\qbvh\traversal.rs:19
  16: rapier3d::pipeline::query_pipeline::QueryPipeline::colliders_with_aabb_intersecting_aabb<rapier3d::dynamics::ccd::ccd_solver::impl$1::predict_impacts_at_next_positions::closure_env$0>
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\rapier3d-0.14.0\src\pipeline\query_pipeline.rs:683
  17: rapier3d::dynamics::ccd::ccd_solver::CCDSolver::predict_impacts_at_next_positions
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\rapier3d-0.14.0\src\dynamics\ccd\ccd_solver.rs:283
  18: rapier3d::pipeline::physics_pipeline::PhysicsPipeline::run_ccd_motion_clamping
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\rapier3d-0.14.0\src\pipeline\physics_pipeline.rs:329
  19: rapier3d::pipeline::physics_pipeline::PhysicsPipeline::step
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\rapier3d-0.14.0\src\pipeline\physics_pipeline.rs:562
  20: bevy_rapier3d::plugin::context::RapierContext::step_simulation
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_rapier3d-0.16.0\src\plugin\context.rs:237
  21: bevy_rapier3d::plugin::systems::step_simulation<tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_rapier3d-0.16.0\src\plugin\systems.rs:603
  22: core::ops::function::FnMut::call_mut<void (*)(bevy_ecs::change_detection::ResMut<bevy_rapier3d::plugin::context::RapierContext>,bevy_ecs::system::system_param::Res<bevy_rapier3d::plugin::configuration::RapierConfiguration>,bevy_ecs::system::system_param::
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\ops\function.rs:164
  23: core::ops::function::impls::impl$3::call_mut<tuple$<bevy_ecs::change_detection::ResMut<bevy_rapier3d::plugin::context::RapierContext>,bevy_ecs::system::system_param::Res<bevy_rapier3d::plugin::configuration::RapierConfiguration>,bevy_ecs::system::system_p
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\ops\function.rs:290
  24: bevy_ecs::system::function_system::impl$30::run::call_inner<tuple$<>,bevy_ecs::change_detection::ResMut<bevy_rapier3d::plugin::context::RapierContext>,bevy_ecs::system::system_param::Res<bevy_rapier3d::plugin::configuration::RapierConfiguration>,bevy_ecs:
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.8.0\src\system\function_system.rs:564
  25: bevy_ecs::system::function_system::impl$30::run<tuple$<>,void (*)(bevy_ecs::change_detection::ResMut<bevy_rapier3d::plugin::context::RapierContext>,bevy_ecs::system::system_param::Res<bevy_rapier3d::plugin::configuration::RapierConfiguration>,bevy_ecs::sy
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.8.0\src\system\function_system.rs:567
  26: bevy_ecs::system::function_system::impl$6::run_unsafe<tuple$<>,tuple$<>,tuple$<bevy_ecs::change_detection::ResMut<bevy_rapier3d::plugin::context::RapierContext>,bevy_ecs::system::system_param::Res<bevy_rapier3d::plugin::configuration::RapierConfiguration>
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.8.0\src\system\function_system.rs:403
  27: bevy_ecs::schedule::executor_parallel::impl$2::prepare_systems::async_block$0
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.8.0\src\schedule\executor_parallel.rs:194
  28: core::future::from_generator::impl$1::poll<enum$<bevy_ecs::schedule::executor_parallel::impl$2::prepare_systems::async_block_env$0> >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\future\mod.rs:91
  29: async_executor::impl$4::spawn::async_block$0<tuple$<>,core::future::from_generator::GenFuture<enum$<bevy_ecs::schedule::executor_parallel::impl$2::prepare_systems::async_block_env$0> > >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\async-executor-1.4.1\src\lib.rs:144
  30: core::future::from_generator::impl$1::poll<enum$<async_executor::impl$4::spawn::async_block_env$0<tuple$<>,core::future::from_generator::GenFuture<enum$<bevy_ecs::schedule::executor_parallel::impl$2::prepare_systems::async_block_env$0> > > > >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\future\mod.rs:91
  31: async_task::raw::RawTask<core::future::from_generator::GenFuture<enum$<async_executor::impl$4::spawn::async_block_env$0<tuple$<>,core::future::from_generator::GenFuture<enum$<bevy_ecs::schedule::executor_parallel::impl$2::prepare_systems::async_block_env$
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\async-task-4.3.0\src\raw.rs:511
  32: async_task::runnable::Runnable::run
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\async-task-4.3.0\src\runnable.rs:309
  33: async_executor::Executor::try_tick
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\async-executor-1.4.1\src\lib.rs:181
  34: bevy_tasks::task_pool::impl$1::scope::closure$0<bevy_ecs::schedule::executor_parallel::impl$1::run_systems::closure_env$0,tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_tasks-0.8.0\src\task_pool.rs:201
  35: std::thread::local::LocalKey<async_executor::LocalExecutor>::try_with<async_executor::LocalExecutor,bevy_tasks::task_pool::impl$1::scope::closure_env$0<bevy_ecs::schedule::executor_parallel::impl$1::run_systems::closure_env$0,tuple$<> >,alloc::vec::Vec<tu
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\std\src\thread\local.rs:445
  36: std::thread::local::LocalKey<async_executor::LocalExecutor>::with<async_executor::LocalExecutor,bevy_tasks::task_pool::impl$1::scope::closure_env$0<bevy_ecs::schedule::executor_parallel::impl$1::run_systems::closure_env$0,tuple$<> >,alloc::vec::Vec<tuple$
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\std\src\thread\local.rs:421
  37: bevy_tasks::task_pool::TaskPool::scope<bevy_ecs::schedule::executor_parallel::impl$1::run_systems::closure_env$0,tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_tasks-0.8.0\src\task_pool.rs:148
  38: bevy_ecs::schedule::executor_parallel::impl$1::run_systems
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.8.0\src\schedule\executor_parallel.rs:126
  39: bevy_ecs::schedule::stage::impl$1::run
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.8.0\src\schedule\stage.rs:884
  40: bevy_ecs::schedule::Schedule::run_once
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.8.0\src\schedule\mod.rs:342
  41: bevy_ecs::schedule::impl$1::run
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_ecs-0.8.0\src\schedule\mod.rs:360
  42: bevy_app::app::App::update
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_app-0.8.0\src\app.rs:119
  43: bevy_winit::winit_runner_with::closure$0
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_winit-0.8.0\src\lib.rs:618
  44: winit::platform_impl::platform::event_loop::impl$2::run_return::closure$0<tuple$<>,bevy_winit::winit_runner_with::closure_env$0>
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:206
  45: alloc::boxed::impl$45::call_mut<tuple$<enum$<winit::event::Event<tuple$<> > >,ref_mut$<enum$<winit::event_loop::ControlFlow> > >,dyn$<core::ops::function::FnMut<tuple$<enum$<winit::event::Event<tuple$<> > >,ref_mut$<enum$<winit::event_loop::ControlFlow> >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\alloc\src\boxed.rs:1879
  46: winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0<tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop\runner.rs:245
  47: core::panic::unwind_safe::impl$23::call_once<tuple$<>,winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<tuple$<> > >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\panic\unwind_safe.rs:271
  48: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<tuple$<> > >,tuple$<> >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\std\src\panicking.rs:492
  49: hashbrown::raw::sse2::Group::load
  50: std::panicking::try<tuple$<>,core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<tuple$<> > > >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\std\src\panicking.rs:456
  51: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<tuple$<> > >,tuple$<> >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\std\src\panic.rs:137
  52: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<tuple$<> >::catch_unwind<tuple$<>,tuple$<>,winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<tuple$<> > >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop\runner.rs:152
  53: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<tuple$<> >::call_event_handler<tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop\runner.rs:239
  54: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<tuple$<> >::move_state_to<tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop\runner.rs:341
  55: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<tuple$<> >::main_events_cleared<tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop\runner.rs:227
  56: winit::platform_impl::platform::event_loop::flush_paint_messages<tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:726
  57: winit::platform_impl::platform::event_loop::thread_event_target_callback::closure$0<tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:2091
  58: core::ops::function::FnOnce::call_once<winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<tuple$<> >,tuple$<> >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\ops\function.rs:248
  59: core::panic::unwind_safe::impl$23::call_once<isize,winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<tuple$<> > >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\panic\unwind_safe.rs:271
  60: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<tuple$<> > >,isize>
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\std\src\panicking.rs:492
  61: hashbrown::raw::sse2::Group::load
  62: std::panicking::try<isize,core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<tuple$<> > > >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\std\src\panicking.rs:456
  63: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<tuple$<> > >,isize>
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\std\src\panic.rs:137
  64: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<tuple$<> >::catch_unwind<tuple$<>,isize,winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<tuple$<> > >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop\runner.rs:152
  65: winit::platform_impl::platform::event_loop::thread_event_target_callback<tuple$<> >
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:2271
  66: CallWindowProcW
  67: EnumChildWindows
  68: IsIconic
  69: KiUserCallbackDispatcher
  70: NtUserDispatchMessage
  71: DispatchMessageW
  72: winit::platform_impl::platform::event_loop::EventLoop<tuple$<> >::run_return<tuple$<>,bevy_winit::winit_runner_with::closure_env$0>
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:221
  73: winit::platform_impl::platform::event_loop::EventLoop<tuple$<> >::run<tuple$<>,bevy_winit::winit_runner_with::closure_env$0>
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:191
  74: winit::event_loop::EventLoop<tuple$<> >::run<tuple$<>,bevy_winit::winit_runner_with::closure_env$0>
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\event_loop.rs:154
  75: bevy_winit::run<bevy_winit::winit_runner_with::closure_env$0>
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_winit-0.8.0\src\lib.rs:240
  76: bevy_winit::winit_runner_with
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_winit-0.8.0\src\lib.rs:663
  77: bevy_winit::winit_runner
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_winit-0.8.0\src\lib.rs:280
  78: core::ops::function::Fn::call<void (*)(bevy_app::app::App),tuple$<bevy_app::app::App> >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\ops\function.rs:77
  79: alloc::boxed::impl$46::call<tuple$<bevy_app::app::App>,dyn$<core::ops::function::Fn<tuple$<bevy_app::app::App>,assoc$<Output,tuple$<> > > >,alloc::alloc::Global>
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\alloc\src\boxed.rs:1886
  80: bevy_app::app::App::run
             at C:\Users\Paul\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_app-0.8.0\src\app.rs:135
  81: bevy_rapier_ccd_unreachable_bug::main
             at .\src\main.rs:5
  82: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc\library\core\src\ops\function.rs:248

My 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.

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()
        .insert_bundle(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)),
        ))
        .insert(
            // 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(),
        )
        .insert(RigidBody::Fixed);

    commands
        .spawn()
        .insert(Collider::ball(1.0))
        .insert(RigidBody::Dynamic)
        // Commenting out this line it no longer panics
        .insert(Ccd::enabled())
        .insert(Velocity::linear(Vec3::Z * 10000.0));
}

paul-hansen avatar Aug 12 '22 01:08 paul-hansen

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.

janhohenheim avatar Mar 14 '23 15:03 janhohenheim

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),
    ));
}

paul-hansen avatar Mar 22 '23 22:03 paul-hansen

As for me, my code magically works now. Strange 🤷‍♂️

janhohenheim avatar Mar 22 '23 23:03 janhohenheim

Also ran into this same issue.

marcelchampagne avatar May 11 '23 18:05 marcelchampagne

It only happens when i use ComputedColliderShape::TriMesh, if i switch to ComputedColliderShape::ConvexDecomposition(VHACDParameters::default()), it stops

hgeist2 avatar Jul 06 '23 18:07 hgeist2

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

1755 avatar Mar 24 '24 19:03 1755

Recent duplicate here: https://github.com/dimforge/bevy_rapier/issues/386

ThierryBerger avatar May 24 '24 09:05 ThierryBerger