miquido / AR_quido

Flutter mobile plugin for image recognition using Augmented Reality (AR) features
https://miquido.com
Apache License 2.0
9 stars 3 forks source link

[iOS] Only detects each image one time #19

Open hohler opened 7 months ago

hohler commented 7 months ago

Hello Miquido Team

I noticed that with multiple images, every image is only detected once.

Example: I have 2 images

  1. recognize first image
  2. recognize second image
  3. try to recognize first image - it will not recognize it
  4. recognize second image - works

I found a easy fix, maybe this is already the right way.

Replace

class ARQuidoViewController: UIViewController {
...
     if let nodeToRemove = detectedImageNode {
          nodeToRemove.removeFromParentNode()
     }
...
}

with

private var lastImageAnchor: ARImageAnchor?
...
class ARQuidoViewController: UIViewController {
...
       if let nodeToRemove = detectedImageNode {
            nodeToRemove.removeFromParentNode()
            if (lastImageAnchor != nil) {
                sceneView.session.remove(anchor: lastImageAnchor!)
            }
        }
...
}
PiotrMitkowski commented 7 months ago

Hello @hohler!

Looks good - would you mind creating a PR for it?