Trying to destroy with the trigger in the 1st place.
What could be the reason why it does not work in the 2nd place
var TriggerEngelYok = pc.createScript('triggerEngelYok');
TriggerEngelYok.prototype.initialize = function () {
this.entity.collision.on('triggerenter', this.onTriggerEnter, this);
};
TriggerEngelYok.prototype.update = function (dt) {
};
TriggerEngelYok.prototype.onTriggerEnter = function (triggerEntity) {
if (triggerEntity.tags.has('player')) {
var k = this.app.root.findByName('Root').findByName('Boxengel');
k.enabled = false;
}
};