-
Notifications
You must be signed in to change notification settings - Fork 2k
[fix] physics-2d contact disable not working #15149 (#15158) #15224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] physics-2d contact disable not working #15149 (#15158) #15224
Conversation
* [fix] physics-2d contact disable not working cocos#15149 * tweaks and add docs
@@ -87,17 +95,26 @@ export class PhysicsContactListener extends b2.ContactListener { | |||
public finalizeContactEvent () { | |||
PhysicsContactListener._contactMap.forEach((contact: PhysicsContact, key: string) => { | |||
//console.log('forEach', key, collision); | |||
|
|||
// emit collision event | |||
if (!contact.disabled || contact.status === Contact2DType.BEGIN_CONTACT) { //BEGIN_CONTACT always emits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why always emit event when begin contact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why always emit event when begin contact.
PhysicsContact is destroyed when ref decreases to 0, and not recycled. User can never get a PhysicsConact before BeginContact to disable it. However this check seems redundant, which I think can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still not fixed contact.disable in cocos creator 3.7.4 still not working @lealzhan
[fix] physics-2d contact disable not working Physics2d contact disable not working since 3.7.1 #15149
tweaks and add docs
Re: #
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: