Skip to content

Panic when adding multi body joint dynamically. #906

@newDINO

Description

@newDINO

Panics when adding multi body joint after initialization between steps.
Backtrace info:

thread 'main' (542881) panicked at crates/rapier3d/../../src/dynamics/joint/multibody_joint/multibody.rs:223:32:
attempt to subtract with overflow
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_const::panic_const_sub_overflow
   3: rapier3d::dynamics::joint::multibody_joint::multibody::Multibody::append
   4: rapier3d::dynamics::joint::multibody_joint::multibody_joint_set::MultibodyJointSet::insert
   5: all_examples3::debug_add_multibody_joint3::init_world::{{closure}}
   6: rapier_testbed3d::harness::Harness::step_with_graphics
   7: rapier_testbed3d::testbed::update_testbed
   8: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe

I created an example for reproduction at newDINO/rapier@6da6777. Run cargo run --bin all_examples3 and select "(Debug) add multibody joint".
As is shown in the example, adding joint during initialization works fine.

Changing multi body joints to impulse joints also shows no problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions