blaze-2d
Version:
A fast and simple WebGL 2 2D game engine written in TypeScript
22 lines • 722 B
JavaScript
export default class CollisionFilter {
constructor(category = 0x001, mask = 0xffffffff, group = 0) {
this.category = 0x0001;
this.mask = 0xffffffff;
this.group = 0;
this.category = category;
this.mask = mask;
this.group = group;
}
/**
* Determines wether this collision should be rejected or not.
*
* @param filter The filter to check against
* @returns Wether or not the collision can occur
*/
reject(filter) {
return ((this.group !== 0 && this.group === filter.group) ||
(this.mask & filter.category) === 0 ||
(filter.mask & this.category) === 0);
}
}
//# sourceMappingURL=collisionFilter.js.map