Replace Node Renderable ( Same Rotation, Position And Scale ) With Another Node Renderable In Sceneform Sdk
I am new to sceneform sdk for Android . I have added one Transformable Node , then i applied some rotation , scaling and changed its position also. Now on click of button i need to
Solution 1:
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();
Then i added another node which is going to replace first one with same transformation.
Nodenode=newNode();
Vector3position= transformableNode.getLocalPosition();
Quaternionrotation= transformableNode.getLocalRotation();
TransformableNodeandyNOde=newTransformableNode(arView.getTransformationSystem());
andyNOde.setRenderable(andyRenderable);
andyNOde.setLocalPosition(position);
andyNOde.setLocalRotation(rotation);
andyNOde.setParent(node);
anchorNode.removeChild(transformableNode);
anchorNode.addChild(node);
It is working with this code, may be you were doing something wrong, check your code twice. Hope it will help!
Post a Comment for "Replace Node Renderable ( Same Rotation, Position And Scale ) With Another Node Renderable In Sceneform Sdk"