phaser-raycaster
Version:
Raycasting plugin for Phaser 3.
21 lines (20 loc) • 493 B
JavaScript
/**
* Destroy object
*
* @method Raycaster.Map#destroy
* @memberof Raycaster.Map
* @instance
* @since 0.10.3
*/
export function destroy() {
//destroy reference to map object in mapped object
if(this.object.type === 'body' || this.object.type === 'composite') {
delete this.object.raycasterMap;
}
else if(this.object.data) {
this.object.data.remove('raycasterMap');
}
for(let key in this) {
delete this[key];
}
}