I’ve got an Entity “AnimationHolder” which is a Template Instance of an FBX with a camera motion path in it. I want to control the animation with a script.
I added an Anim, and set the State Graph… it plays when it is activated by default.
I’ve set up the code (using another project as a guide - I’m totally new to PlayCanvas) like this:
AnimationController.attributes.add("animationHolder", {type: "entity", array: false, default: [""], title: "Animation Holder"});
AnimationController.prototype.initialize = function() {
console.log(this.animationHolder);
this.animComponent = this.animationHolder.anim;
this.animComponent.play("Take 001", 0);
};
Why is this.animationHolder always null?
(as a new user I can only embed one media image: here was a screen grab showing the settings in AnimationHolder)
(as a new user I can only embed one media image: here was a screen grab showing the link from animationController to AnimationHolder)
p.s. I wondered if it might be a race on initialize order, but that value is null forever if spammed through update too