anchor = hitResult.createAnchor();
anchorNode = new AnchorNode(anchor);
anchorNode.setParent(arView.getArSceneView().getScene());
transformableNode = new TransformableNode(arView.getTransformationSystem()); // As you said i have added one transformablenode which will allow transformation.
transformableNode.setParent(anchorNode);
transformableNode.setRenderable(modelRenderable);
transformableNode.select();
然后我添加了另一个节点,它将用相同的转换替换第一个节点。
Node node = new Node();
Vector3 position = transformableNode.getLocalPosition();
Quaternion rotation = transformableNode.getLocalRotation();
TransformableNode andyNOde = new TransformableNode(arView.getTransformationSystem());
andyNOde.setRenderable(andyRenderable);
andyNOde.setLocalPosition(position);
andyNOde.setLocalRotation(rotation);
andyNOde.setParent(node);
anchorNode.removeChild(transformableNode);
anchorNode.addChild(node);
它正在使用此代码,可能是您做错了什么,请检查您的代码两次。希望它会有所帮助!