Skip to content

Set a change flag in Collider::set_active_collision_types - #1055

Open
RoboX2020 wants to merge 1 commit into
dimforge:masterfrom
RoboX2020:fix/collision-types-change-flag
Open

RoboX2020 wants to merge 1 commit into
dimforge:masterfrom
RoboX2020:fix/collision-types-change-flag

Conversation

@RoboX2020

Copy link
Copy Markdown

Fixes #1050.

Collider::set_active_collision_types only assigned the field and never set a change flag, so the broad phase never re-tested the collider: a pair that the collision-types filter rejected at creation time (e.g. kinematic-fixed contacts, off by default) was never found again after the types were widened at runtime.

The fix inserts ColliderChanges::GROUPS when the value changes, mirroring set_collision_groups and set_solver_groups, so the broad phase re-tests the collider and the pair is created.

The included regression test (issue_1050_collision_types_change_flag.rs) uses the reproducer from the issue: a kinematic ball resting inside a fixed box, with types widened to ActiveCollisionTypes::all() after two steps. Verified locally:

  • Without the fix: the new test fails exactly on the widen-after-start assertion (the from-the-start sanity check passes).
  • With the fix: the new test passes; rapier3d lib tests 81/81, rapier2d lib tests 64/64, and the collision/broad-phase-related integration tests (broad_phase_pair_filter, collision_pipeline_moving_bodies, sleep_wake, sleep_wide_bodies, whole_island_sleep, contact_clustering, persistent_islands, query_pipeline_subshapes, issue_749, pipeline_counters) all pass.

The setter only assigned the field, so the broad phase never re-tested
the collider: a pair that the collision-types filter rejected at
creation time was never found again after the types were widened at
runtime (e.g. enabling kinematic-fixed contacts after some steps).

Insert ColliderChanges::GROUPS on change, mirroring
set_collision_groups and set_solver_groups. Adds a regression test with
the reproducer from the issue: it fails before this change and passes
after it.

Fixes dimforge#1050

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collider::set_active_collision_types sets no change flag: widening a collider's types after creation never creates the pair

1 participant