How to reset or restart the ARCore sessio

こ雲淡風輕ζ 提交于 2019-12-23 04:59:08

问题


I developed based on Android platform, and the initial state of AR session is loaded in fragment form. In order to reset the AR session, a solution found on Google is to update the fragments. At present, the session can be restarted, but the frame cannot be updated, and I cannot realize my own business of following the frame changes. Seek help: 1. Why to update fragments? Frame does not update 2. or do the partners have a better way to reset the AR session

The main idea is to use a cycle timer. If the time exceeds 9 seconds, the AR session will be reset once, but other functions will be executed with each frame update in 9 seconds onUpdateListener method was in onComplete function,but it didnt work within 9 seconds

 public void onComplete() {


        ArFragment arFragment=(ArFragment) context.getSupportFragmentManager().findFragmentById(R.id.ux_fragment);
        ARInitModel.getInstance().setArFragment(arFragment,imageView,R.raw.andy,textView);
        ArSceneView senceView = arFragment.getArSceneView();
        Scene scene = senceView.getScene();
        Scene.OnUpdateListener onUpdateListener=frameTime -> {
                System.out.println("onUpdateListener ========================");
        };
        scene.addOnUpdateListener(onUpdateListener);
    }


public static void ReplaceFragment(ConstructNode constructNode){


        ArFragment arFragment = new AugmentedImageFragment();
        context.getSupportFragmentManager().beginTransaction()
                .replace(R.id.ux_fragment,arFragment).commit();
        System.out.println("arFragment ReplaceFragment========="+arFragment.getId());
       }

来源:https://stackoverflow.com/questions/58995749/how-to-reset-or-restart-the-arcore-sessio

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