Sceneform-android-sdk: Clear Planes and Anchor

Created on 13 Aug 2018  路  5Comments  路  Source: google-ar/sceneform-android-sdk

How I could restart the detection, like clean all, without need to finish and relaunch the activity?

Would expected something like session.clear() or ArFragment.clear(). Maybe is a feature request.

question

Most helpful comment

@ManuelTS you can read here that exactly saying that I don't wanna relaunch/restart the activity, because this is a solution, but not a good behaviour for the app. So if we don't have something that clean the planes and anchor we should put this as a feature request.

Like pause and resume, didn't had before and came after a feature request.

All 5 comments

Look at my answer to my own question on stack overflow. You must restart your activity.

@ManuelTS you can read here that exactly saying that I don't wanna relaunch/restart the activity, because this is a solution, but not a good behaviour for the app. So if we don't have something that clean the planes and anchor we should put this as a feature request.

Like pause and resume, didn't had before and came after a feature request.

My mistake and my apologies. But I leave my answer here, maybe it helps someone.

@Canato - Can you expand on why restarting the activity does not work in your case? Another alternative is to destroy the ArFragment and Session and recreate them. Planes are a fundamental feature of ARCore, which uses planes to build a model of the real world and the locations of the planes are refined as more information is gained, so I am not sure what is gained by resetting the session.

Clearing the renderables from the scene can be done by iterating over the scene's children and remove them.

Anchors can be iterated over from the ARCore session using getAllAnchors() and detached from the session.

@claywilkinson I have tried detaching ArFragment and add it again to activity. In this case, I'm getting error which don't crash my app all the time but still crash it some time. Which means I'm unable to use this as a solution.

E/ArSceneView: Error loading libarsceneview_jni.so
    java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.xyz.main-6CoFwVVqYpwyQVwA8mCoXA==/base.apk"],nativeLibraryDirectories=[/data/app/com.xyz.main-6CoFwVVqYpwyQVwA8mCoXA==/lib/arm64, /data/app/com.xyz.main-6CoFwVVqYpwyQVwA8mCoXA==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]] couldn't find "libarsceneview_jni.so"
        at java.lang.Runtime.loadLibrary0(Runtime.java:1067)
        at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
        at java.lang.System.loadLibrary(System.java:1667)
        at com.google.ar.sceneform.ArSceneView.reportEngineType(SourceFile:165)
        at com.google.ar.sceneform.ArSceneView.resumeSession(SourceFile:49)
        at com.google.ar.sceneform.ArSceneView.resume(SourceFile:39)
        at com.google.ar.sceneform.ux.BaseArFragment.start(BaseArFragment.java:507)
        at com.google.ar.sceneform.ux.BaseArFragment.onResume(BaseArFragment.java:315)
        at androidx.fragment.app.Fragment.performResume(Fragment.java:2718)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1364)
        at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1686)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1750)
        at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:443)
        at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2494)
        at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2285)
        at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2240)
        at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2143)
        at androidx.fragment.app.FragmentManager$3.run(FragmentManager.java:417)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7116)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

scolar picture scolar  路  4Comments

StevenOttoG picture StevenOttoG  路  4Comments

rohitagarwal3011 picture rohitagarwal3011  路  4Comments

KamikX picture KamikX  路  4Comments

hcjung2000 picture hcjung2000  路  3Comments