Skeleton Blending


#1

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?


#2

I may have found something that could help but it’s still not exactly what I’m looking for and it appears to be outdated and built to be standalone: https://github.com/chinedufn/skeletal-animation-system


#3

Blending two skeletons is a question i have too. Is the blend supposed to output the two skeletons into one ? Then how do you use the result?


#4

I’ve made a script for it. Once I clean it up, I will send it to you. Remind me in case I forget.