我已经尽力删除可渲染物,但单击按钮后可渲染量并没有消失。我已经获得了堆栈溢出类似帖子的帮助,但即使在应用以下代码后我也无法删除可渲染内容。 我正在使用虚拟设备进行测试。
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();
}
}
});
请告诉我一个解决方案
您必须删除使用setRenderable()
的Node
, [在这种情况下] 确保在anchorNode
对象上呈现Renderable
。