rapier
rapier copied to clipboard
Crash with thin `ColliderBuilder::convex_decomposition(...)` hitting stuff when attached to a rigid body
This seems to happen consistently when I create a small/thin collider that then falls and hits something.
It doesn't happen when the collider is just created or falls down, it crashes as it hits something else. I also can't reproduce this with bigger shapes, only seems to happen with thin colliders.
I'm running this on a set of vertices with polyline indices, the indices look like this
[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10], [10, 11], [11, 12]]
stacktrace:
thread 'main' panicked at 'index out of bounds: the len is 2 but the index is 2', /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/shape/convex_polygon.rs:144:48
stack backtrace:
0: rust_begin_unwind
at /rustc/1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966/library/core/src/panicking.rs:142:14
2: core::panicking::panic_bounds_check
at /rustc/1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966/library/core/src/panicking.rs:84:5
3: <parry2d::shape::convex_polygon::ConvexPolygon as parry2d::shape::polygonal_feature_map::PolygonalFeatureMap>::local_support_feature
4: parry2d::query::contact_manifolds::contact_manifolds_pfm_pfm::contact_manifold_pfm_pfm
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/query/contact_manifolds/contact_manifolds_pfm_pfm.rs:81:13
5: <parry2d::query::default_query_dispatcher::DefaultQueryDispatcher as parry2d::query::query_dispatcher::PersistentQueryDispatcher<ManifoldData,ContactData>>::contact_manifold_convex_convex
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/query/default_query_dispatcher.rs:581:21
6: parry2d::query::contact_manifolds::contact_manifolds_composite_shape_composite_shape::contact_manifolds_composite_shape_composite_shape::{{closure}}::{{closure}}::{{closure}}::{{closure}}
7: parry2d::query::contact_manifolds::contact_manifolds_composite_shape_composite_shape::contact_manifolds_composite_shape_composite_shape::{{closure}}::{{closure}}::{{closure}}
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/query/contact_manifolds/contact_manifolds_composite_shape_composite_shape.rs:103:17
8: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
at /rustc/1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966/library/core/src/ops/function.rs:290:13
9: <parry2d::query::visitors::bounding_volume_intersections_visitor::BoundingVolumeIntersectionsVisitor<T,F> as parry2d::partitioning::visitor::SimdVisitor<T,parry2d::bounding_volume::simd_aabb::SimdAABB>>::visit
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/query/visitors/bounding_volume_intersections_visitor.rs:42:25
10: parry2d::partitioning::qbvh::traversal::<impl parry2d::partitioning::qbvh::qbvh::QBVH<T>>::traverse_depth_first_with_stack
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/partitioning/qbvh/traversal.rs:43:19
11: parry2d::query::contact_manifolds::contact_manifolds_composite_shape_composite_shape::contact_manifolds_composite_shape_composite_shape::{{closure}}::{{closure}}
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/query/contact_manifolds/contact_manifolds_composite_shape_composite_shape.rs:172:13
12: parry2d::query::contact_manifolds::contact_manifolds_composite_shape_composite_shape::contact_manifolds_composite_shape_composite_shape::{{closure}}
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/query/contact_manifolds/contact_manifolds_composite_shape_composite_shape.rs:99:9
13: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
at /rustc/1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966/library/core/src/ops/function.rs:290:13
14: <parry2d::query::visitors::bounding_volume_intersections_visitor::BoundingVolumeIntersectionsVisitor<T,F> as parry2d::partitioning::visitor::SimdVisitor<T,parry2d::bounding_volume::simd_aabb::SimdAABB>>::visit
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/query/visitors/bounding_volume_intersections_visitor.rs:42:25
15: parry2d::partitioning::qbvh::traversal::<impl parry2d::partitioning::qbvh::qbvh::QBVH<T>>::traverse_depth_first_with_stack
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/partitioning/qbvh/traversal.rs:43:19
16: parry2d::partitioning::qbvh::traversal::<impl parry2d::partitioning::qbvh::qbvh::QBVH<T>>::traverse_depth_first
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/partitioning/qbvh/traversal.rs:19:9
17: parry2d::query::contact_manifolds::contact_manifolds_composite_shape_composite_shape::contact_manifolds_composite_shape_composite_shape
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/query/contact_manifolds/contact_manifolds_composite_shape_composite_shape.rs:179:5
18: <parry2d::query::default_query_dispatcher::DefaultQueryDispatcher as parry2d::query::query_dispatcher::PersistentQueryDispatcher<ManifoldData,ContactData>>::contact_manifolds
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/parry2d-0.9.0/src/query/default_query_dispatcher.rs:425:13
19: rapier2d::geometry::narrow_phase::NarrowPhase::compute_contacts::{{closure}}
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/rapier2d-0.14.0/src/geometry/narrow_phase.rs:888:25
20: <core::slice::iter::IterMut<T> as core::iter::traits::iterator::Iterator>::for_each
at /rustc/1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966/library/core/src/slice/iter/macros.rs:211:21
21: rapier2d::geometry::narrow_phase::NarrowPhase::compute_contacts
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/rapier2d-0.14.0/src/geometry/narrow_phase.rs:791:9
22: rapier2d::pipeline::physics_pipeline::PhysicsPipeline::detect_collisions
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/rapier2d-0.14.0/src/pipeline/physics_pipeline.rs:131:9
23: rapier2d::pipeline::physics_pipeline::PhysicsPipeline::step
at /home/darth/.cargo/registry/src/github.com-1ecc6299db9ec823/rapier2d-0.14.0/src/pipeline/physics_pipeline.rs:576:13
24: witch_hunt_platformer::physics::Physics::step
at ./src/physics.rs:72:9
25: witch_hunt_platformer::game::Game::update
at ./src/game.rs:161:9
26: witch_hunt_platformer::run
at ./src/main.rs:298:17
27: witch_hunt_platformer::main
at ./src/main.rs:21:5
28: core::ops::function::FnOnce::call_once
at /rustc/1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966/library/core/src/ops/function.rs:248:5
https://github.com/dimforge/parry/pull/168