Problem: doing a bunch of animations yourself is time consuming.
Solution: import model to mixamo and choose what you want.
New problem: how to attach/change the weapon/shield/hair on the character and keep the animation.
i.e. Player animated without holding anything, yet in a pose to hold something. Need to add an object to their hand which flows with the animation. How would I do this?
Put the objects you want to attach as childs of your entity, in the initialize function of player scale them like this
this.sword=this.entity.findByName("Axe");
var scale = this.sword.getWorldTransform().getScale();
this.sword.setLocalScale(50, 50, 50);
this.sword=this.entity.findByName("Mace");
var scale = this.sword.getWorldTransform().getScale();
this.sword.setLocalScale(4200, 4200, 4200);
As you can see the scale factor can be very different based on entity dimensions, then you need a function that attach the object (weapon in this example) to entity bone (you have to know the name of the bone) like this
equip_sword: function (name,type) {
this.sword=this.entity.findByName(name);
this.rhand = this.model.findByName('Bip01 D Mano');
this.sword.reparent(this.rhand);
if(type==="BLADE" || type==="SWORD" || type==="AXE" || type ==="HAMMER" || type ==="MACE" ) {
this.sword.setLocalPosition(10,-4,-1);
if (name==="Axe") {
this.sword.setLocalEulerAngles(90, 0, 205);
} else {
this.sword.setLocalEulerAngles(100, 0, 45);
}
}
if (name==='Waraxe') {
this.sword.setLocalPosition(-6,7,-35);
this.sword.setLocalEulerAngles(100, 20, -10);
}
if(type==='POLE') {
this.sword.setLocalPosition(27,22,-55);
this.sword.setLocalEulerAngles(120, 0, -35);
}
this.wRange=0;
this.wDamage=3;
},