AmmoJSPlugin Does Not Call Legacy onCollisionEvent

Yo @trevordev … I think i found issue…

If i register a DUMMY collision using registerOnPhysicsCollide i then get my legacy onCollideEvent

The problem this code here:


            if (mainImpostor._onPhysicsCollideCallbacks.length > 0) {
                if (this._isImpostorInContact(mainImpostor)) {
                    for (var collideCallback of mainImpostor._onPhysicsCollideCallbacks) {
                        for (var otherImpostor of collideCallback.otherImpostors) {
                            if (mainImpostor.physicsBody.isActive() || otherImpostor.physicsBody.isActive()) {
                                if (this._isImpostorPairInContact(mainImpostor, otherImpostor)) {
                                    mainImpostor.onCollide({ body: otherImpostor.physicsBody });
                                    otherImpostor.onCollide({ body: mainImpostor.physicsBody });
                                }
                            }
                        }
                    }
                }
            }

It does not take into account the mainImpostor.onCollideEvent not equal null like the physicsImpsoter.onCollide does with this code:

``
if (!this._onPhysicsCollideCallbacks.length && !this.onCollideEvent) {
return;
}

``

The current code is just checking mainImpostor._onPhysicsCollideCallback.length.

I think we need to add support for mainImposter.onCollideEvent as well… Please :slight_smile:

1 Like