Search Unity

Image Tracking "extended"

Discussion in 'AR' started by SimoneSotgiu, Jan 24, 2019.

  1. SimoneSotgiu

    SimoneSotgiu

    Joined:
    Feb 10, 2017
    Posts:
    1
    Hi everybody,
    I'm doing an AR app using Unity 2018.3 and ARKit 2.0 plugin from BitBucket.

    I would like to know if with the Image Tracking It's possible to have something like "extended tracking" (like in Vuforia). I mean the 3d model should be in the scene also when the image target is out of camera.

    In XCode I'm able to do that using the configuration "ARWorldTrackingConfiguration()" and set "configuration.detectionImages = trackedImages" and "configuration.maximumNumberOfTrackedImages = 1", as explained here: https://developer.apple.com/documentation/arkit/arimagetrackingconfiguration

    Particular attention to: Image-only tracking lets you anchor virtual content to known images only when those images are in view of the camera. World tracking with image detection lets you use known images to add virtual content to the 3D world, and continues to track the position of that content in world space even after the image is no longer in view.

    Thanks in advance,
    Simon
     
  2. unity_Ckcp1nhulDvDjg

    unity_Ckcp1nhulDvDjg

    Joined:
    Apr 1, 2019
    Posts:
    2
    Did you ever figure this out?
     
  3. unity_Ckcp1nhulDvDjg

    unity_Ckcp1nhulDvDjg

    Joined:
    Apr 1, 2019
    Posts:
    2
    I figured it out. Take a look at the
    GenerateImageAnchor
    script and look at how
    UpdateImageAnchor
    sets the
    imageAnchorGO.SetActive(false)
    if the

    imageAnchorGO.activeSelf
    . Just comment out the check for isTracked, and simply always update the position.

    Code (CSharp):
    1.  
    2.     void UpdateImageAnchor(ARImageAnchor arImageAnchor)
    3.     {
    4.         Debug.LogFormat("image anchor updated[{0}] : tracked => {1}", arImageAnchor.identifier, arImageAnchor.isTracked);
    5.         if (arImageAnchor.referenceImageName == referenceImage.imageName) {
    6.                 if (!imageAnchorGO.activeSelf)
    7.                 {
    8.                     imageAnchorGO.SetActive(true);
    9.                 }
    10.                 imageAnchorGO.transform.position = UnityARMatrixOps.GetPosition(arImageAnchor.transform);
    11.                 imageAnchorGO.transform.rotation = UnityARMatrixOps.GetRotation(arImageAnchor.transform);
    12.         }
    13.  
    14.     }
     
    aaaavvvv and mtessmann like this.
  4. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    488
    Hey any luck on how to do this for current ARKit?
     
    DanielStringer likes this.