Sfoglia il codice sorgente

Master (#1638)

* Support Physics Collide Event For All Imposters

Passing ‘null’ to registerOnPyhsicsCollide will allow to register
collision events for any/all imposters. Can filter collisions in your
collision event handler.

* Support Zero Length Import Check List

Use otherImport.length === 0 for all imposter collision
MackeyK24 8 anni fa
parent
commit
5abd31d128
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      src/Physics/babylon.physicsImpostor.ts

+ 1 - 1
src/Physics/babylon.physicsImpostor.ts

@@ -336,7 +336,7 @@ module BABYLON {
             var otherImpostor = this._physicsEngine.getImpostorWithPhysicsBody(e.body);
             if (otherImpostor) {
                 this._onPhysicsCollideCallbacks.filter((obj) => {
-                    return obj.otherImpostors.indexOf(otherImpostor) !== -1
+                    return (obj.otherImpostors.length === 0 || obj.otherImpostors.indexOf(otherImpostor) !== -1)
                 }).forEach((obj) => {
                     obj.callback(this, otherImpostor);
                 })