Hi,
I am have some problems understanding how to get a trigger to play an animation on a different entity? It just seams not to be clicking in my head. Am I not defining the entity I want to play the animation on?
I know the trigger is firing, but it is says “undefined animation” and my head just is not getting it.
And if it is about the defining the entity, how would I go about defining it?
Iv been stuck on dis almost two weeks now?
Here is what I have tried already.
var Inzone = pc.createScript('inzone');
//Inzone.attributes.add('Objects', {type: 'entity', default: 'Door_Cabben01'});
//Inzone.attributes.add('AnimationName', {type: 'string', default: 'Door_Cabben01.json'});
// initialize code called once per entity
Inzone.prototype.initialize = function() {
this.entity.collision.on('triggerenter', this.onTriggerEnter, "Dylan");
};
//Inzone.prototype.onTriggerEnter = function(entity) {
//alert("Test");
// Object.animation.play('AnimationName');
//};
Inzone.prototype.onTriggerEnter = function (result) {
console.log("This is it " + result);
this.app.root.findByName('/Door_Cabben01');
this.Door_Cabben01.animation.play('Door_Cabben01.json',1 );
//if (result.other.rigidbody) {
// this.entity.sound.play("hit");
Door_Cabben01.animation.play('/ModelsAssets/Door_Cabben01.json',[1] );
//}
};