Hey guys! I have a basic concept of how I’m supposed to blend two skeletons, but I can’t seem to find the right way to put it into engine syntax!
Here’s the code I have right now, but obviously, it’s not working as intended. Because I don’t know how I am supposed to do it.
var RootMotion = pc.createScript('RootMotion');
RootMotion.attributes.add('animationName', {type: 'string', title: 'Animation', default: 'Reload'});
RootMotion.prototype.upperSkeleton = null;
// initialize code called once per entity
RootMotion.prototype.initialize = function() {
this.upperGraph = this.entity.model.model.graph.findByName("Spine");
this.upperSkeleton = new pc.Skeleton(this.upperGraph);
this.upperAnimation = this.entity.animation.getAnimation("Reload");
///////////
this.oldAnim = this.entity.animation.skeleton.animation;
this.upperSkeleton = this.entity.animation.skeleton;
this.upperSkeleton.animation = this.upperAnimation.resource;
this.upperSkeleton.addTime(0.0);
this.upperSkeleton.updateGraph();
this.upperSkeleton.animation = oldAnim;
};
// update code called every frame
RootMotion.prototype.update = function(dt) {
// upperSkeleton.addTime(dt);
// upperSkeleton.updateGraph();
};
Can anybody help out with this?