Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/collision/narrow_phase/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,13 @@ impl<C: AnyCollider> NarrowPhase<'_, '_, C> {
// Get the thread-local bit vector for tracking status changes.
let mut state_change_bits = self
.contact_status_bits_thread_local
.get_or(|| RefCell::new(BitVec::new(contact_pair_count)))
.get_or(|| {
// No thread-local bit vector exists for this thread yet.
// Create a new one with the same capacity as the global bit vector.
let mut bit_vec = BitVec::new(contact_pair_count);
bit_vec.set_bit_count_and_clear(contact_pair_count);
RefCell::new(bit_vec)
})
.borrow_mut();

let contacts = &mut contacts.weight;
Expand Down
7 changes: 6 additions & 1 deletion src/data_structures/bit_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ impl BitVec {
/// Performs an in-place bitwise OR operation with another [`BitVec`].
#[inline]
pub fn or(&mut self, other: &Self) {
debug_assert!(self.block_count == other.block_count);
debug_assert!(
self.block_count == other.block_count,
"block counts do not match for `BitVec::or` ({} != {})",
self.block_count,
other.block_count
);

for i in 0..self.block_count {
self.blocks[i] |= other.blocks[i];
Expand Down