dimforge / rapier

2D and 3D physics engines focused on performance.
https://rapier.rs
Apache License 2.0
3.89k stars 242 forks source link

Panic when changing rigid body types or when disabling rigid bodies that are colliding with each other in bevy plugin w/ fixed time step. #477

Open AnthonyTornetta opened 1 year ago

AnthonyTornetta commented 1 year ago

The error message is that an index out of bounds error is happening here in interaction_groups.rs line 440:

let mask1 = if !is_fixed1 { self.body_masks[i1] } else { 0 };
let mask2 = if !is_fixed2 { self.body_masks[i2] } else { 0 };

A simple fix could be verifying i1 and i2 are within self.body_masks.len() - I'll test that to see.

sebcrozet commented 1 year ago

Do you have a minimal reproducer for this? This looks like a bug with the enabling/disabling system not assigning a correct active_set_offset to bodies that were modified.