Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: provide non Rigidbody contact events and Rigidbody prioritization #3094

Merged

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Oct 10, 2024

This extends the RigidbodyContactEventManager by adding a new interface that provides ContactEventHandlerInfo:

  • ContactEventHandlerInfo.ProvideNonRigidBodyContactEvents: When set to true, non-Rigidbody collisions with the registered Rigidbody will generate contact event notifications.

    • If you want a registered Rigidbody to generate contact event notifications when colliding with non-registered objects that just have colliders (i.e. terrain, static world objects, etc.) , then setting this to true will generate contact events.
  • ContactEventHandlerInfo.HasContactEventPriority: When set to true, the Rigidbody will be prioritized as the instance that generates the event if the Rigidbody colliding does not have priority.

    • If this value is tied to ownership and a non-kinematic body collides with a kinematic body and the sequence of the collision places the kinematic body first in the contact event processing, then the non-kinematic body will be considered "preferred" when triggering the contact event notification.

The ContactEventHandlerInfo is queried each time there are contact events to be processed.

This addition does not impact any previous configurations/uses of RigidbodyContactEventManager.

MTT-9182

Changelog

  • Added IContactEventHandlerWithInfo that derives from IContactEventHandler that can be updated per frame to provide ContactEventHandlerInfo information to the RigidbodyContactEventManager when processing collisions.
    • ContactEventHandlerInfo.ProvideNonRigidBodyContactEvents: When set to true, non-Rigidbody collisions with the registered Rigidbody will generate contact event notifications.
    • ContactEventHandlerInfo.HasContactEventPriority: When set to true, the Rigidbody will be prioritized as the instance that generates the event if the Rigidbody colliding does not have priority.

Testing and Documentation

  • Includes integration tests (wip).
  • Requires public documentation update (part of Rigidbody pass).
  • Includes XML API Documentation additions and updates.

Provide an extended IContactEventHandlerWithInfo that allows users to prioritize which object is being collided with as well as being able to determine if the instance should return non-rigidbody contact events.
Adding changelog entry.
Adding associated PR to the entry
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review October 10, 2024 13:21
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner October 10, 2024 13:21
Adding XML API documentation.
Assuring the default non-info contact event handler sets priority to the non-kinematic bodies.
Added validation test for RigidbodyContactEventManager
@NoelStephensUnity NoelStephensUnity merged commit 0055e1c into develop-2.0.0 Oct 11, 2024
24 checks passed
@NoelStephensUnity NoelStephensUnity deleted the fix/provide-non-rigidbody-contact-events branch October 11, 2024 12:36
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants