How to remove all planes in ARCore

时间秒杀一切 提交于 2019-12-23 23:06:15

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!