fix: release collisions on leaving room
This commit is contained in:
parent
0f61faabb4
commit
b336a33727
|
@ -36,11 +36,7 @@ export class Collider extends decorate(Trait) {
|
|||
}
|
||||
|
||||
destroy() {
|
||||
for (let i = 0; i < this._isCollidingWith.length; i++) {
|
||||
const entity = this._isCollidingWith[i];
|
||||
entity.emit('collisionEnd', this.entity);
|
||||
}
|
||||
this._isCollidingWith = [];
|
||||
this.entity.releaseAllCollisions();
|
||||
}
|
||||
|
||||
get collisionGroup() {
|
||||
|
@ -76,6 +72,10 @@ export class Collider extends decorate(Trait) {
|
|||
}
|
||||
},
|
||||
|
||||
removedFromRoom: () => {
|
||||
this.entity.releaseAllCollisions();
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,14 @@ export class Collider extends decorate(Trait) {
|
|||
return -1 !== this._collidesWithGroups.indexOf(collisionGroup);
|
||||
},
|
||||
|
||||
releaseAllCollisions: () => {
|
||||
for (let i = 0; i < this._isCollidingWith.length; i++) {
|
||||
const entity = this._isCollidingWith[i];
|
||||
entity.emit('collisionEnd', this.entity);
|
||||
}
|
||||
this._isCollidingWith = [];
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user