SceneView / sceneview-android

SceneView is a 3D and AR Android Composable and View with Google Filament and ARCore. This is a Sceneform replacement in Kotlin
Apache License 2.0
816 stars 159 forks source link

Some issue with ArSceneView #411

Closed Razorquake closed 4 months ago

Razorquake commented 7 months ago

Hello, I am new to this library and wanted to use this library in one of my projects. But the problem is, although I can show the model in 3D mode in my app using the Scene function. But in AR mode, my model is not visible. I will provide the code of the composable function that I made and the screenshot in AR mode.

@Composable
fun ARView(){
    val engine = rememberEngine()
    val modelLoader = rememberModelLoader(engine)
    val model = modelLoader.createModel("dna.glb")
    var frame by remember { mutableStateOf<Frame?>(null) }
    val childNodes = rememberNodes()
    ARScene(
        modifier = Modifier.fillMaxSize(),
        engine = engine,
        modelLoader = modelLoader,
        onSessionUpdated = { session, updatedFrame ->
            frame = updatedFrame
        },
        sessionConfiguration = {session, config ->
                               config.lightEstimationMode = Config.LightEstimationMode.DISABLED
            config.instantPlacementMode = Config.InstantPlacementMode.LOCAL_Y_UP
        },
        onGestureListener = rememberOnGestureListener(
            onSingleTapConfirmed = { motionEvent, node ->
                val hitResults = frame?.hitTest(motionEvent.x, motionEvent.y)
                val anchor = hitResults?.firstOrNull {
                    it.isValid(depthPoint = false, point = false)
                }?.createAnchorOrNull()

                if (anchor != null) {
                    val anchorNode = AnchorNode(engine = engine, anchor = anchor)
                    anchorNode.addChildNode(
                        ModelNode(modelInstance = modelLoader.createInstance(model)!!)
                    )
                    childNodes += anchorNode
                }
            }
        )
    )
}

WhatsApp Image 2024-02-08 at 18 43 15_0068c819 Note: I am using Arsceneview version 2.0.3, I have earlier used some of the older versions of the library, there my model appears in AR mode.

UmerHamza commented 7 months ago

use the "AR model view composer" sample App code . it is working correctly.

github-actions[bot] commented 4 months ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 4 months ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.