I when I use the augemnted image function,the program will stuck in tracking state.
case TRACKING:
fitToScanView.setVisibility(View.GONE);
if (!augmentedImageMap.containsKey(augmentedImage)) {
SnackbarHelper.getInstance().showMessage(this, "showing");
node = new AugmentedImageNode(this);
this.image = augmentedImage;
node.setImage(this.image);
augmentedImageMap.put(this.image, node);
arFragment.getArSceneView().getScene().addChild(node);
}
break;
I have tried to remove the node with this function,but it didn't work
public void clearDetect(View view) {
Collection<Anchor> anchors = arFragment.getArSceneView().getSession().getAllAnchors();
for(Anchor anchor : anchors) {
anchor.detach();
Log.d("leolog2",anchor.getTrackingState().toString());
}
fitToScanView.setVisibility(View.VISIBLE);
Iterator<Map.Entry<AugmentedImage, AugmentedImageNode>> iter =
augmentedImageMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<AugmentedImage, AugmentedImageNode> entry = iter.next();
AugmentedImage face = entry.getKey();
AugmentedImageNode faceNode = entry.getValue();
faceNode.setParent(null);
iter.remove();
augmentedImageMap.remove(this.image);
}
}
do anybody know how to leave the tracking state and detect another image?
Please try below code it's may be helpfull