Как повернуть файл ball.fbx в дополненной реальности с помощью Android Studio? - PullRequest
0 голосов
/ 19 июня 2019

Я пытаюсь повернуть файл активов ball (sfb) в дополненной реальности с помощью android studio.Я попробовал какой-то код, чтобы вращать мяч, ссылаясь на приложение солнечной системы от Google.Но я не знаю, почему мяч вращается?Мне нужно какое-то предложение, где я допустил ошибку в своем коде.

 private void addModelToScene(Anchor anchor, ModelRenderable modelRenderable) {
        AnchorNode anchorNode = new AnchorNode(anchor);
        TransformableNode transformableNode = new 
        TransformableNode(arFragment.getTransformationSystem());
        RotatingNode rotatingNode = new RotatingNode();
        arFragment.getArSceneView().getScene().addChild(anchorNode); 
         rotatingNode.setParent(anchorNode);
        rotatingNode.setRenderable(modelRenderable);
        transformableNode.select();
    }
//this is my RotatingNode
private ObjectAnimator createAnimation(){
Quaternion orientation1 = Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), 0);
        Quaternion orientation2 = Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), 120);
        Quaternion orientation3 = Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), 240);
        Quaternion orientation4 = Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), 360);
        ObjectAnimator orbitAnimation = new ObjectAnimator();
        orbitAnimation.setObjectValues(orientation1, orientation2, orientation3, orientation4);
        orbitAnimation.setPropertyName("localRotation");
        orbitAnimation.setEvaluator(new QuaternionEvaluator());
        orbitAnimation.setRepeatCount(ObjectAnimator.INFINITE);
        orbitAnimation.setRepeatMode(ObjectAnimator.RESTART);
        orbitAnimation.setInterpolator(new LinearInterpolator());
        orbitAnimation.setAutoCancel(true);
        return orbitAnimation;
}

Я ожидаю, что результат будет вращать шар, но сможет разместить только шар.

...