Jondolf / avian

ECS-driven 2D and 3D physics engine for the Bevy game engine.
https://crates.io/crates/avian3d
Apache License 2.0
1.58k stars 119 forks source link

Crash in 0.15 due to system ordering ambiguities #571

Open spectria-limina opened 1 day ago

spectria-limina commented 1 day ago

Using the lastest main and:

            PhysicsPlugins::default()
                .build()
                .disable::<IntegratorPlugin>()
                .disable::<SolverPlugin>()
                .disable::<SleepingPlugin>(),

I get the following crash:

   0: bevy_ecs::schedule::schedule::schedule
           with name=PhysicsSchedule
             at /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.15.0/src/schedule/schedule.rs:379
   1: bevy_ecs::system::function_system::system
           with name="avian2d::schedule::run_physics_schedule"
             at /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.15.0/src/system/function_system.rs:65
thread 'main' panicked at /home/alercah/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.15.0/src/schedule/schedule.rs:383:33:
Error when initializing schedule PhysicsSchedule: Systems with conflicting access have indeterminate run order.
25 pairs of systems with conflicting data access have indeterminate execution order. Consider adding `before`, `after`, or `ambiguous_with` relationships between these:
 -- update_aabb_intervals (in sets BroadPhase, UpdateStructures) and run_substep_schedule (in set Substep)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and solve_swept_ccd (in sets PostSubstep, SweptCcdSet)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and add_new_aabb_intervals (in sets BroadPhase, UpdateStructures)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and collect_collision_pairs (in sets BroadPhase, CollectCollisions)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and propagate_collider_transforms (in sets First, NarrowPhase)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and update_child_collider_position (in sets First, NarrowPhase)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and reset_collision_states (in set NarrowPhase)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and run_post_process_collisions_schedule (in sets NarrowPhase, PostProcess)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and <NarrowPhasePlugin<Collider> as Plugin>::{{closure}}
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and report_contacts (in set ReportContacts)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and remove_ended_collisions
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and update_ray_caster_positions (in set SpatialQuery)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and update_shape_caster_positions (in set SpatialQuery)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and <SpatialQueryPlugin as Plugin>::{{closure}} (in set SpatialQuery)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and raycast (in set SpatialQuery)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and shapecast (in set SpatialQuery)
    conflict on: bevy_ecs::world::World
 -- run_substep_schedule (in set Substep) and handle_rigid_body_removals
    conflict on: bevy_ecs::world::World
 -- solve_swept_ccd (in sets PostSubstep, SweptCcdSet) and collect_collision_pairs (in sets BroadPhase, CollectCollisions)
    conflict on: ["avian2d::collision::broad_phase::AabbIntersections"]
 -- solve_swept_ccd (in sets PostSubstep, SweptCcdSet) and update_child_collider_position (in sets First, NarrowPhase)
    conflict on: ["avian2d::position::Position", "avian2d::position::Rotation"]
 -- solve_swept_ccd (in sets PostSubstep, SweptCcdSet) and run_post_process_collisions_schedule (in sets NarrowPhase, PostProcess)
    conflict on: bevy_ecs::world::World
 -- solve_swept_ccd (in sets PostSubstep, SweptCcdSet) and update_ray_caster_positions (in set SpatialQuery)
    conflict on: ["avian2d::position::Rotation"]
 -- solve_swept_ccd (in sets PostSubstep, SweptCcdSet) and update_shape_caster_positions (in set SpatialQuery)
    conflict on: ["avian2d::position::Rotation"]
 -- solve_swept_ccd (in sets PostSubstep, SweptCcdSet) and <SpatialQueryPlugin as Plugin>::{{closure}} (in set SpatialQuery)
    conflict on: ["avian2d::position::Rotation"]
 -- solve_swept_ccd (in sets PostSubstep, SweptCcdSet) and raycast (in set SpatialQuery)
    conflict on: ["avian2d::position::Rotation"]
 -- solve_swept_ccd (in sets PostSubstep, SweptCcdSet) and shapecast (in set SpatialQuery)
    conflict on: ["avian2d::position::Rotation"]

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `avian2d::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`!

I can try to further minimize if need be.

spectria-limina commented 1 day ago

Leaving all the plugins enables works.