Not able to delete renderable in Arcore using anchornodes

94 views Asked by At

I have tried my best to remove the renderable but the renderable is not getting vanished after i click on the button. I had taken help of the stackoverflow similiar post but i was not able to delete the renderable even after applying the following code. I am using virtual device for testing.

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        if(anchorNode!=null){
            arFragment.getArSceneView().getScene().removeChild(anchorNode);
            anchorNode.getAnchor().detach();
            anchorNode.setParent(null);
            anchorNode = null;

            Toast.makeText(MainActivity.this, "Test Delete - anchorNode removed", Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(MainActivity.this, "Test Delete - markAnchorNode was null", Toast.LENGTH_SHORT).show();
        }
    }
});

Please tell me a solution for this

1

There are 1 answers

0
Hardik Mahant On

You have to remove the Node on which you have used a setRenderable(), [In this case] Make sure you are rendering a Renderable on the anchorNode object.