AnimatorSet - Getting Error: Only one ModelAnimator may play on a ModelRenderable at a time

AnimatorSet - Getting Error: Only one ModelAnimator may play on a ModelRenderable at a time

我正在尝试一个接一个地播放多个动画,但我似乎无法让它工作。它给我错误:

Only one ModelAnimator may play on a ModelRenderable at a time

我已按照此 Whosebug 答案中的说明进行操作:

private void animateModel(ModelRenderable modelRenderable) {

        AnimationData danceData = modelRenderable.getAnimationData("Armature|Pecking.002");
        ModelAnimator modelAnimator = new ModelAnimator(danceData, modelRenderable);

        AnimationData danceData2 = modelRenderable.getAnimationData("Armature|Walking");
        ModelAnimator modelAnimator2 = new ModelAnimator(danceData2, modelRenderable);


        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.play(modelAnimator).before(modelAnimator2);
        animatorSet.start();


    }

我做错了什么?

据我所知,从 1.16 开始,不再支持 ModelAnimator 和 ModelRenderable.getAnimationData。

如果必须使用低于 1.16 的版本,

   List<Animator> animatorList = new ArrayList();
   animatorList.add(modelAnimator);
   animatorList.add(modelAnimator2);
   animatorSet.playSequentially(animatorList);
   animatorSet.start();

你可以像上面那样做。 我没有测试代码,因为我使用的是 sceneform 1.16。