Include component ID in all physics events - #73
Open
ashtonmeuser wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
Yet another alternative would be to bundle the other PredictedComponentID with the collision information along with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
An alternative to the problem raised in #56. Related PRs: #56, #57, #72.
This is perhaps the cleanest solution to the problem of collision exits due to deleted identities, albeit the most breaking change.
Rather than cacheing recently-deleted identities to be surfaced in
PredictedRigidbody2/3D.onCollisionExit(GameObject other, ...), this implementation includes a PredictedComponentID in all physics events making the equivalentPredictedRigidbody2/3D.onCollisionExit(GameObject other, PredictedComponentID otherId, ...). The checks in Assets/PurrDiction/Runtime/PhysicsEvents/Predicted2DPhysics.cs:124 and Assets/PurrDiction/Runtime/PhysicsEvents/Predicted3DPhysics.cs:62 now fire exit events despite the other GameObject being falsy.In short, the issue with collision/trigger exit events is that we're not guaranteed to have a valid GameObject to refer to. Therefore, with the current physics event signatures, we can either hide the exit event (current behaviour) or present the event with a
nullGameObject. Neither of these options are great. This proposal includes the PredictedComponentID in all physics events which is guaranteed to exist despite the GameObject beingnull.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.