bevy_xpbd icon indicating copy to clipboard operation
bevy_xpbd copied to clipboard

assertion failed: b.min.cmple(b.max).all() in `ColliderAabb::grow`

Open mgi388 opened this issue 6 months ago • 4 comments
trafficstars

I've started spawning a child entity on my unit which contains a collider and (I think) when I move that unit avian panics.

I don't really know the conditions that are causing this to panic. Is there any useful info I can provide on top of this stack trace?

thread 'main' panicked at /Users/me/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/avian3d-0.2.1/src/collision/collider/mod.rs:378:9:
assertion failed: b.min.cmple(b.max).all()
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: avian3d::collision::collider::ColliderAabb::grow
             at /Users/me/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/avian3d-0.2.1/src/collision/collider/mod.rs:378:9
   4: avian3d::collision::collider::backend::update_aabb
   5: core::ops::function::FnMut::call_mut
             at /Users/me/.rustup/toolchains/1.86.0-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5
   6: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /Users/me/.rustup/toolchains/1.86.0-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:13
   7: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4) .> Out>>::run::call_inner
             at /Users/me/code/mgi388/bevy/crates/bevy_ecs/src/system/function_system.rs:1002:21
   8: <Func as bevy_ecs::system::function_system::SystemParamFunction<fn(F0,F1,F2,F3,F4) .> Out>>::run
             at /Users/me/code/mgi388/bevy/crates/bevy_ecs/src/system/function_system.rs:1005:17
   9: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
             at /Users/me/code/mgi388/bevy/crates/bevy_ecs/src/system/function_system.rs:800:19
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `avian3d::collision::collider::backend::update_aabb<avian3d::collision::collider::parry::Collider>`!
Encountered a panic in system `avian3d::schedule::run_physics_schedule`!
Encountered a panic in system `bevy_app::main_schedule::FixedMain::run_fixed_main`!
Encountered a panic in system `bevy_time::fixed::run_fixed_main_schedule`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!

Version: [email protected]

mgi388 avatar Apr 23 '25 00:04 mgi388

This commonly means that the position or rotation is somehow NaN or infinite, causing the computed world-space AABB to be invalid. I'd maybe try to add some logs to see if that's the case, and if it is, figure out what's causing it to happen

Jondolf avatar Apr 27 '25 10:04 Jondolf

I just got the exact same panic, however I was able to track down for me it was not the issue of Avian, but the fact that I was calling .normalize() on a vector that ended up calculating to a point where it was not finite, and like Jondolf said this made the translation of the Transform non finite, causing the issue. Changing this to .normalize_or_zero() fixed it for me.

For anyone having a similar issue, I recommend enabling the feature "debug_glam_assert" or "glam_assert" for bevy to help track down where this issue might be originating from, after testing with this on it helped to track the exact line that was causing the problem.

Hybrid-Creations avatar May 08 '25 01:05 Hybrid-Creations

In my case I accidentally negated one of the lengths of a Collider::cuboid. A pretty dumb mistake I know, but a clearer error message may be warranted?

cornytrace avatar May 21 '25 20:05 cornytrace

Had this issue, problem was a Collider::rectangle with a negative dimension.

dsgallups avatar May 25 '25 20:05 dsgallups