When an animation is playing on a lower layer when an animation on a higher layer goes to loop or go to the next animation in sequence, the armature will instantly assume the current pose of the lower layer, then interpolate to the current pose of the higher layer. This makes the animation not seamless as I expected it should.
Here is my code:
// "main1" is lower than "main2".
// Both layers control all joints.
Tween shootCycle = Tweens.sequence(Tweens.loopDuration(1f, anim.action("aim-pistol")), anim.action("shoot-pistol"));
anim.addAction("shoot-cycle", new BaseAction(shootCycle));
anim.setCurrentAction("idle", "main1");
anim.setCurrentAction("shoot-cycle", "main2");
Perhaps you can create your custom AnimationMask and in contains() method add an extra check to see if the joint is also affected by an upper layer then return false.
private boolean isAffectedByUpperLayers(Object target) {
boolean active = false;
for (String name : anim.getLayerNames()) {
if (name.equals(layer)) {
active = true;
continue;
}
if (!active) {
continue;
}
AnimLayer lyr = anim.getLayer(name);
if (lyr.getMask().contains(target)) {
return true;
}
}
return false;
}
I think it’s broken because of this line.
if (lyr.getMask().contains(target)) {
contains does not check if the joint is currently in use, right? So basically all lower layers will find joints affected by higher layers, and never play anything on those joints. Is there a better way to check for joint use?