#StackBounty: #android #arcore #sceneform Sceneform – Getting Vector3 position from screen pixel position?

Bounty: 100

The Sceneform camera has the camera.setWorldPosition method which accepts a Vector3.

I have currently calculated the center point of where the user pinches the screen using the ScaleGestureDetector.

My question is, how can I calculate the Vector3 position I want to move to based a single point on the screen?

Let’s say the user pinches near the middle of the screen — the ratio for the X and Y coordinates calculated from the phone’s display metrics are

X: 0.58122176, Y: 0.46196362

How do I convert it into a Vector3 so my SceneView camera can zoom in that position on the screen?

 private class ZoomGestureDetector extends ScaleGestureDetector.SimpleOnScaleGestureListener {
        @Override
        public boolean onScale(ScaleGestureDetector detector) {
            
            float ratioX = detector.getFocusX() / displayMetrics.widthPixels;
            float ratioY = detector.getFocusY() / displayMetrics.heightPixels;

            Log.d(TAG, "onScale: Called X: " + ratioX + ", Y: " + ratioY);

            Camera camera = sceneView.getScene().getCamera();
            //camera.setWorldPosition(); <--- How to calculate vector3

            return false;
        }

        @Override
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            isScaling = true;
            return true;
        }

        @Override
        public void onScaleEnd(ScaleGestureDetector detector) {
            isScaling = false;

        }
    }

Edit:

Essentially I’m trying to get the camera to zoom in/out where I’m pinching on the screen.


Get this bounty!!!

#StackBounty: #android #unity3d #aar #arcore Errors: "Unable to find UnityARCore" and "DllNotFoundException"

Bounty: 100

I’ve built an ARCore app in Unity using the ARFoundation Package. Then I embedded Unity app inside a native Android app by following the instructions in this link: Embedded Unity within Android App.

The AR app works fine as a Stand Alone app. But I’m getting the error while embedding it inside a native Android app:

E/Unity: Unable to find UnityARCore
E/Unity: DllNotFoundException: UnityARCore
at (wrapper managed-to-native) UnityEngine.XR.ARCore.Api:UnityARCore_setCameraPermissionProvider (UnityEngine.XR.ARCore.Api/CameraPermissionRequestProvider)
at UnityEngine.XR.ARCore.ARCoreCameraExtension.Register () [0x00000] in <filename unknown>:0


Get this bounty!!!

#StackBounty: #android #3d #augmented-reality #arcore How can i scan a qr code and place an 3d object using ar core?

Bounty: 100

here i need some suggestion or a want to a way of doing this

scenario : i want to scan a qr code and after scanning the qr code i want place a 3d object in the ar scene . here i dont want to use google vision api and instead i want to use any qr reader package and want to place it. is there reference / url so that it will help me to achieve this ?

i used this package for qr scan https://github.com/zxing/zxing


Get this bounty!!!

#StackBounty: #android #android-studio #3d #arcore #sceneform Draw Renderable Shape on 3D Model using Sceneform Android

Bounty: 50

I am using SceneForm Android SDK to render 3D Model in Android APP.

To display the 3D Model I am using this code below which also supports Rotating and Zooming feature in 3D Model

 private fun renderLocalObject(position: Int) {

    ModelRenderable.builder()
            .setSource(appCompatActivity, Uri.parse(models.get(position)))
            .setRegistryId(models.get(position))
            .build()
            .thenAccept { modelRenderable: ModelRenderable ->
                addNodeToScene(modelRenderable)
            }
            .exceptionally { throwable: Throwable? ->
                var message: String?
                message = if (throwable is CompletionException) {
                    Logger.DebugLog("ERROR LOADING 3D", throwable.message)
                    "Internet is not working"
                } else {
                    Logger.DebugLog("ERROR LOADING 3D", "FAILED TO LOAD")
                    "Can't load Model"

                }
                null
            }
}

private fun addNodeToScene(model: ModelRenderable) {

    if (sceneView != null) {

        val transformationSystem = makeTransformationSystem()
        val dragTransformableNode = DragTransformableNode(5f, transformationSystem)
        dragTransformableNode.renderable = model
        sceneView!!.scene.addChild(dragTransformableNode)
        dragTransformableNode.select()


        sceneView!!.getScene()
                .addOnPeekTouchListener { hitTestResult: HitTestResult?, motionEvent: MotionEvent? ->
                    transformationSystem.onTouch(
                            hitTestResult,
                            motionEvent
                    )

                    when (motionEvent?.action) {
                        MotionEvent.ACTION_UP ->
                            if (hitTestResult != null) {
                                addDot(hitTestResult)
                            }

                    }


                }
    }
}

I want to draw a sphere renderable shape directly over the 3d model, but the Node is not getting stuck model.

Below is the required output

Expected Output

Below is the final output of my code

Final Output

This is my code for adding node

  private fun addDot(hitTestResult: HitTestResult){
    val color = Color(.8f, 0f, 0f)
    MaterialFactory.makeOpaqueWithColor(appCompatActivity, color)
            .thenAccept { material->
                // The sphere is in local coordinate space, so make the center 0,0,0
                val sphere = ShapeFactory.makeSphere(0.05f, Vector3.zero(),
                        material)
                val indicatorModel = Node()
                indicatorModel.setParent(hitTestResult.node)
                indicatorModel.worldPosition = hitTestResult.point
              //  indicatorModel.localPosition = Vector3(0f, 0f, -1f)
                indicatorModel.renderable = sphere
               // sceneView!!.getScene().addChild(indicatorModel)


            }
}

Is there any way to draw shape directly over the 3d model.


Get this bounty!!!

#StackBounty: #augmented-reality #arcore Visualize the 3D feature map associated with ARCore Cloud Anchors

Bounty: 50

I am developing an application using ARCore Cloud Anchors. My question is related to the document describing that, when you host an anchor, it creates a 3D feature map of the environment and binds it to the anchor location and stores it.

Question: Is it possible to visualize the 3D feature map associated with ARCore Cloud Anchors on the application side? I want to know it because, by understanding quantitatively where exactly to scan, the app is able to help the general users to resolve anchors more smoothly.

The documentation also says find an area with visual features that are easily distinguishable from each other, but I don’t think it is quantitative enough to derive the best way to scan an area.


Get this bounty!!!