Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Collision events and
CollidingEntities
updates are currently handled by the narrow phase, and some parts of the engine are dependent on collision events. This coupling is a bit unnecessary and annoying; if you made a custom narrow phase, you would also need to handle collision events manually. Not all apps also need collision events, so it would be nice if you could disable it.Solution
Move all collision event logic into a new
ContactReportingPlugin
and addPhysicsStepSet::ReportContacts
.The narrow phase is now only responsible for managing
Collisions
and adding contacts to it. Contact reporting is fully separate from everything else, so collision detection, sleeping and everything else should work without it.The main remaining issue is that the collision states like
during_current_frame
are handled in a somewhat confusing and error-prone way. Ideally, the narrow phase wouldn't need to manage them, but for detecting which collisions have ended (and in the future, reusing previous contact manifolds), it might be necessary.