D
D
dendead2020-12-02 17:12:51
Java
dendead, 2020-12-02 17:12:51

How to check surface tracking (ARCore Android)?

I need to track the moment when the smartphone finds the surface. I'm trying to do it like this:

arFragment.getArSceneView().getScene().addOnUpdateListener(frameTime ->
{
    Frame frame = arFragment.getArSceneView().getArFrame();

    if (!surfaceChecker)
    {
        if (frame.getCamera().getTrackingState() == TrackingState.PAUSED)
            // do something
        else if (frame.getCamera().getTrackingState() == TrackingState.TRACKING)
        {
            // do something else
            surfaceChecker = true;
        }
    }
});

Does not work. The code // do something runs right after the camera turns on. What could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question