diff --git a/packages/physics/matter/body.js b/packages/physics/matter/body.js index 4ed30ef..632e468 100644 --- a/packages/physics/matter/body.js +++ b/packages/physics/matter/body.js @@ -153,6 +153,9 @@ export class Body extends AbstractBody { mask = mask | ctor.collisionCategory(group); } this.setCollision(category, mask); + if (entity.isSensor) { + MatterBody.set(this.matterBody, 'isSensor', true); + } } else { this.setCollision(0, 0, -1); diff --git a/packages/physics/traits/collider.trait.js b/packages/physics/traits/collider.trait.js index e5c0ab7..6ad8383 100644 --- a/packages/physics/traits/collider.trait.js +++ b/packages/physics/traits/collider.trait.js @@ -13,6 +13,7 @@ export class Collider extends decorate(Trait) { 'default', ], collisionGroup: 'default', + isSensor: false, } } @@ -25,6 +26,7 @@ export class Collider extends decorate(Trait) { initialize() { this._collisionGroup = this.params.get('collisionGroup'); this._collidesWithGroups = this.params.get('collidesWithGroups').toJS(); + this._isSensor = this.params.get('isSensor'); } get collisionGroup() { @@ -35,6 +37,10 @@ export class Collider extends decorate(Trait) { return this._collidesWithGroups; } + get isSensor() { + return this._isSensor; + } + methods() { return {