问题
How do I remove all detected planes in ARCore and restart the detection of them? Is this even possible? I searched on Google and Stackoverflow with arcore remove/delete all planes and I found nothing useful.
/Edit: I want to have ARCore in the same state after the version check on start up, the grey hand-movement-animation is shown and no planes are detected (so they must be deleted first) and ARCore is trying to detect new planes.
回答1:
Maybe if you give some code I can explain better for your case, but you just need to make:
frame.getUpdatedTrackables(Plane.class).clear();
EDIT (Leaving the previous answer for future research)
Now I know that you are using sceneform, you have to restart the activity. We don't have yet a call like .onPause, .onResume, .clear, etc for this library.
So by now what you can do is restart the activity.
Button btn = findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
startActivity(new Intent(HelloSceneformActivity.this, HelloSceneformActivity.class));
}
});
回答2:
Restarting the app as Clayton Wilkinson said works, I did it with the following code:
Intent i = new Intent(context, Main.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(i);
来源:https://stackoverflow.com/questions/51788827/how-to-remove-all-planes-in-arcore