Search Unity

  1. Read here to learn more about our latest preview of the XR Interaction Toolkit.
    Dismiss Notice
  2. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  3. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Unity ARFoundation v3.0

Discussion in 'AR' started by tdmowrer, Aug 29, 2019.

  1. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,447
    Great! Thanks @tdmowrer I’ll look into it.
     
  2. Balours

    Balours

    Joined:
    Nov 27, 2013
    Posts:
    52
    @tdmowrer
     
  3. mkrfft

    mkrfft

    Joined:
    Sep 8, 2017
    Posts:
    9
    @tdmowrer I can confirm that having a button toggling focusmode works on iOS. However setting it at in the settings or setting it by script on Start() does not affect it at all. At what time should I set the focusMode to fixed for it to take effect?
     
  4. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    590
    Hard to say, since it looks like we're wading into undefined behavior territory. I would setup a coroutine to set the autofocus a few frames after the camera is enabled and experiment with the timing.
     
  5. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    590
    Yeah, that's pretty broken. It will be fixed in 3.0.0-preview.4
     
  6. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    590
    For now, you can work around this by giving the ARCamera a non-identity transform. Set its X position to be 0.001, for instance. This will trigger the correct code path. For this to work, make sure you're using the TrackedPoseDriver with the "Use Relative Transform" checkbox checked.
     
    Balours likes this.
  7. pwshaw

    pwshaw

    Joined:
    Sep 16, 2014
    Posts:
    13
    Is there an ETA on when ARFoundation will be completely out of the development/ preview phase, and will have full support for all the ARKit 3 features?
     
    Last edited: Oct 10, 2019
  8. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    590
    Verified (non-preview) packages are tied to specific Unity releases, so the next verified release will be 2020.1. The current ARFoundation 3.0.0-preview packages are the preview of this release.
     
    Cromfeli likes this.
  9. Cromfeli

    Cromfeli

    Joined:
    Oct 30, 2014
    Posts:
    198
    Thank you very much for the heads up on this
     
  10. trnq1ll0

    trnq1ll0

    Joined:
    Aug 30, 2019
    Posts:
    23
    Building a simple AR project for iOS under Windows 10, with the help of iOS Builder, fails because of AR Foundation 3.0.0 Preview 4:

    Builder output:


    My "solution": downgrading to last stable versions:
    AR Foundation from 3.0.0 Preview 4 to 2.1.4
    AR Subsystem from 3.0.0 Preview 4 to 2.1.1
    AR Core from 3.0.0 Preview 4 to 2.1.2
    AR Kit XR Plugin from 3.0.0 Preview 4 to 2.1.1
     
  11. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    590
    What version of Xcode? In ARFoundation 3.0, we can target either Xcode 10 or Xcode 11. We do this based on what you choose in the Build Settings. However, on Windows, you can't pick a version of Xcode (since it is not installed) so we always pick Xcode 11.

    The errors you posted look like linker errors I would expect to get if building with Xcode 10 and linking against an Xcode 11 lib.
     
  12. TalespinJoe

    TalespinJoe

    Joined:
    Aug 20, 2018
    Posts:
    17
    When using the latest preview packages and Unity 2019.2.10f1 and I try to run the ARKitFaceBlendShapes scene, I am greeted with an error pink shader on the entire screen. Did I go wrong somewhere?

    This is what xcode spits out:

    So this seems to be an issue (as expected) with the background shader. So when I check out the shader. I get the following:

    The editor.log just repeats the same message (they're in more shaders, so might be something unrelated to ARFoundation)

    Edit:
    Seems to be an issue with the shader compiler on Catalina: https://issuetracker.unity3d.com/issues/ios
     
    Last edited: Oct 24, 2019
  13. trnq1ll0

    trnq1ll0

    Joined:
    Aug 30, 2019
    Posts:
    23
    Thanks for your reply. This makes totality sense to me. I think iOS Builder is using XCode10. Don't know if it sometimes support XCode11.
     
  14. pwshaw

    pwshaw

    Joined:
    Sep 16, 2014
    Posts:
    13
    @tdmowrer

    With ARfoundation's SimpleAR scene, the rotation of the Placed Prefab is zeroed out when the scene starts. And when you move the object onto a tracked plane, the object's rotation does not dynamically change to match the rotation of that plane. The rotation of the object remains frozen. I'm wanting to write a script where the Placed Prefab will match the rotation of the tracked plane it's resting on. Is there a way to do this?
     
    Last edited: Nov 1, 2019
  15. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    356
    How AR Foundation is connected to New XR Platform? There is not enough information at this moment on Unity YouTube. I found something on Oculus Connect, but there are no mentions about AR Foundation. Please clarify it.

     
  16. unnanego

    unnanego

    Joined:
    May 8, 2018
    Posts:
    154
    just set the rotation of the placed object to hitPose[0].rotation;
     
    pwshaw likes this.
  17. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    73
    I tried using addressables for updating ImageLibrary but it didn't work out of the box on android with ARFoundation. What aspects of addressables you'd like to engage with XR? Assets and scenes are easily loaded with addressables regardless of XR setup.
     
  18. intermk

    intermk

    Joined:
    Oct 5, 2018
    Posts:
    2
    Hi,

    We're having problems building using BuildPipeline.BuildPlayer() with com.unity.xr.arkit-3.0.0-preview3 and com.unity.xr.arkit-3.0.0-preview4.

    We get an error about the Xcode 10 and Xcode 11 variants of UnityARKit.a colliding.

    Code (log):
    1. Plugin 'UnityARKit.a' is used from several locations:
    2. Packages/com.unity.xr.arkit/Runtime/iOS/Xcode1100/UnityARKit.a would be copied to <PluginPath>/UnityARKit.a
    3. Packages/com.unity.xr.arkit/Runtime/iOS/Xcode1000/UnityARKit.a would be copied to <PluginPath>/UnityARKit.a
    4. Please fix plugin settings and try again.
    We've had a PreBuildProcessor script that tries to delete the Xcode 10 variant of the .a file from Library/PackageCache, which seems to work sometimes...

    Note also that the paths the Editor is complaining about are in the (virtual) Package directory.

    This is the pre-build step:

    Code (CSharp):
    1.  
    2. public class PreBuildProcessor: IPreprocessBuildWithReport
    3.     {
    4.         public int callbackOrder => 0;
    5.  
    6.         public void OnPreprocessBuild(BuildReport report)
    7.         {
    8.             // Remove build-breaking Xcode 10 version of UnityARKit.a
    9.             File.Delete(Application.dataPath + "/../Library/PackageCache/com.unity.xr.arkit@3.0.0-preview.4/Runtime/iOS/Xcode1000/UnityARKit.a");
    10.             File.Delete(Application.dataPath + "/../Library/PackageCache/com.unity.xr.arkit@3.0.0-preview.4/Runtime/iOS/Xcode1000/UnityARKit.a.meta");
    11.            
    12.             // Hmmm. Our build logs say that Unity is attempting to access /Packages/com.unity.xr.arkit/Runtime/iOS/... so let's
    13.             // try that?
    14.             File.Delete(Application.dataPath + "/../Packages/com.unity.xr.arkit/Runtime/iOS/Xcode1000/UnityARKit.a");
    15.             File.Delete(Application.dataPath + "/../Packages/com.unity.xr.arkit/Runtime/iOS/Xcode1000/UnityARKit.a.meta");
    16.         }
    17.     }
    18.  
    However it doesn't work anymore...

    I guess I'll have to fork the package and remove the file?

    Has anyone seen anything similar?
     
  19. intermk

    intermk

    Joined:
    Oct 5, 2018
    Posts:
    2
    OK. I was able to fix it by copying com.unity.xr.arkit-3.0.0-preview.4 into the Packages directory, and removing the offending Xcode 10 variant of the .a.
     
  20. pwshaw

    pwshaw

    Joined:
    Sep 16, 2014
    Posts:
    13
    @unnanego

    Thanks for your help, but I tried that, and unlike hitPose[0].pose, ARRaycastHit does not contain a definition for 'rotation'.

    Did you try to implement this into the existing PlaceOnPlane script?
     
    Last edited: Nov 6, 2019
  21. unnanego

    unnanego

    Joined:
    May 8, 2018
    Posts:
    154
    Code (CSharp):
    1. using System.Collections.Generic;
    2. using System.Linq;
    3. using UnityEngine;
    4. using UnityEngine.EventSystems;
    5. using UnityEngine.XR.ARFoundation;
    6. using UnityEngine.XR.ARSubsystems;
    7.  
    8. [RequireComponent(typeof(ARRaycastManager))]
    9. public class PlaceOnPlane : MonoBehaviour
    10. {
    11.     public GameObject ground;
    12.  
    13.     private GameObject _spawnedObject;
    14.     private static readonly List<ARRaycastHit> Hits = new List<ARRaycastHit>();
    15.     private ARRaycastManager _raycastManager;
    16.     private ARPlaneManager _planeManager;
    17.  
    18.     private void Start()
    19.     {
    20.         _raycastManager = GetComponent<ARRaycastManager>();
    21.         _planeManager = GetComponent<ARPlaneManager>();
    22.     }
    23.  
    24.     private void Update()
    25.     {
    26.         if (StatusTracker.GameStarted) return;
    27.         if (!TryGetTouchPosition(out var touchPosition)) return;
    28.         if (!_raycastManager.Raycast(touchPosition, Hits, TrackableType.PlaneWithinPolygon)) return;
    29.         if (Input.touches.Select(touch => touch.fingerId).Any(id => EventSystem.current.IsPointerOverGameObject(id))) return;
    30.  
    31.         var hitPose = Hits[0].pose;
    32.         _spawnedObject = StatusTracker.SelectedRobot;
    33.         _spawnedObject.SetActive(true);
    34.         _spawnedObject.transform.position = hitPose.position;
    35.         _spawnedObject.transform.rotation = hitPose.rotation;
    36.         ground.SetActive(true);
    37.         ground.transform.position = hitPose.position;
    38.         ground.transform.rotation = hitPose.rotation;
    39.  
    40.         StatusTracker.ActiveRobots[StatusTracker.CurrentIndex] = _spawnedObject;
    41.        
    42.         _planeManager.SetTrackablesActive(false);
    43.     }
    44.  
    45.     private static bool TryGetTouchPosition(out Vector2 touchPosition)
    46.     {
    47.         if (Input.touchCount > 0)
    48.         {
    49.             touchPosition = Input.GetTouch(0).position;
    50.             return true;
    51.         }
    52.  
    53.         touchPosition = default;
    54.         return false;
    55.     }
    56. }
    This is from the current project (I don't instantiate objects, I pool them for performance).
     
  22. RedRabbit_ChaoLun

    RedRabbit_ChaoLun

    Joined:
    Aug 26, 2019
    Posts:
    6
    @tdmourer We are working with an AR tool that loads images references and object references at runtime.

    I saw that images now can be loaded for tracking at runtime. Good.

    But what about object tracking? Can I add them at runtime?

    If not, will it be added later?
     
    samuelmorais and unnanego like this.
  23. RedRabbit_ChaoLun

    RedRabbit_ChaoLun

    Joined:
    Aug 26, 2019
    Posts:
    6
    Last edited: Nov 13, 2019
  24. RedRabbit_ChaoLun

    RedRabbit_ChaoLun

    Joined:
    Aug 26, 2019
    Posts:
    6
    Last edited: Nov 13, 2019
  25. RedRabbit_ChaoLun

    RedRabbit_ChaoLun

    Joined:
    Aug 26, 2019
    Posts:
    6
    upload_2019-11-13_12-49-6.png
    Delete button incorrect in unity2019.3.0b10
     
  26. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    142
    Our game based on ARFoundation 3.0 preview 4 used to build just fine on Unity Cloud Build. However, very recently we started getting this error:

    9058: ▸ ⚠;️ ld: Could not find auto-linked framework 'QuickLookThumbnailing'
    9059: ▸ ❌; ld: symbol(s) not found for architecture arm64
    9060: ▸ ❌; clang: error: linker command failed with exit code 1 (use -v to see invocation)

    We're using Unity 2019.2.11 and XCode 10.2 on UCB. Did something change in XCode or UCB recently that caused this error to suddenly appear?

    There's also a thread about it here:

    https://forum.unity.com/threads/ios-build-unable-to-find-quicklookthumbnailing.777827/

    However, after much googling I'm starting think the error is coming from ARFoundation, so that's why I'm asking here.

    Thank you very much in advance for all help.

    Kind regards,
    Uffe Flarup
     
  27. nieyoub23

    nieyoub23

    Joined:
    May 8, 2016
    Posts:
    27
    With body tracking, is it possible to track from just the waist up? Or does it need to detect the entire body to instantiate?
     
  28. unnanego

    unnanego

    Joined:
    May 8, 2018
    Posts:
    154
    release notes on the new version?
     
    Thimo_ and tyromotion like this.
  29. Russel1

    Russel1

    Joined:
    Jul 12, 2016
    Posts:
    4
    When I start the ARCoreFaceRegions scene on the Sony Xperia XZ Premium, the permission is requested but afterwards the camera screen remains black. But on my Google Pixel 2 it works fine.

    Sony Xperia XZ Premium
    Model:G8141
    Android: 9

    Can anyone confirm the problem?
     
  30. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    168
    With ARKit body tracking, you will have to have almost the entire body to start initiate tracking.

    Todd
     
    Cromfeli likes this.
  31. distastee

    distastee

    Joined:
    Mar 25, 2014
    Posts:
    53
    I may have run into a bug: ARFoundation 3.1.0 and Unity 2019.2.13f1 and ios 13.? on an iPhone 11 Pro - @tdmowrer or @todds_unity

    I am tracking the face using the forward camera while using video / plane tracking from the rear camera. When I turn off the Plane Manager to start facial tracking - the video feed flips temporarily to the forward camera and then just.......pauses.....giving me roughly 30 of these errors in the Xcode console:

    Error pushing pixel buffer to VIO: InvalidCalibrationData
    Session did fail with error: ..... "World tracking failed" NSLocalizedFailureReason= World tracking cannot determine device's position


    The code:
    Code (CSharp):
    1.         private void StartWorldTracking()
    2.         {
    3.             FaceManager.enabled = true;
    4.             PlaneManager.enabled = true;
    5.             HumanBodyManager.enabled = false;
    6.         }
    7.  
    8.         private void StartFaceTracking()
    9.         {
    10.             FaceManager.enabled = false;
    11.             PlaneManager.enabled = false;
    12.             FaceManager.enabled = true;
    13.         }
    I'm calling "StartFaceTracking()" to flip the camera. Note that I disable the FaceManager first before enabling it again (assuming maybe its a weird session bug causing the issue). I've also tried leaving it enabled. I've also tried explicitly enabling it even if its already enabled. All have the same issue.

    For Plane Manager: I'm not subscribed to any of the events. The scene has a face manager, plane manager, raycast manager, and a quickly disabled body manager with 3d pose estimation checked.
     
  32. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    590
    Hi - we've noticed this as well and seems to be an issue in ARKit. It is reproducible in any of the ARKit 3-supported preview packages (and also in simpler test cases I've made). If you restart the session that should workaround the issue, so you can try doing that whenever you switch between modes.
     
    Cromfeli likes this.
  33. distastee

    distastee

    Joined:
    Mar 25, 2014
    Posts:
    53
    Thanks for the note! Based on this I've tried several combinations of setting my (Face/Plane/etc.)Manager off/on and ARSession.Enabled true/false with an ARSession.Reset thrown in for good measure and haven't been able to fix it. Is there a secret sauce to the order?
     
  34. lkdin

    lkdin

    Joined:
    Jun 29, 2018
    Posts:
    10
    Hey there,

    when are you planing to add support for HoloLens and MagicLeap with ARFoundation?

    Is there any (rough) time estimation already?

    Thanks
     
    sphira_co likes this.
  35. sameel

    sameel

    Joined:
    Dec 4, 2015
    Posts:
    15
    I am using unity 2019.2.14, and I have set ARKit as optional from Edit > Project Settings > ARKit Build Settings.
    But I am getting the following error.
    BuildFailedException: You have selected a minimum target iOS version of 10.0.0 and have the ARKit package installed. ARKit requires at least iOS version 11.0 (See Player Settings > Other Settings > Target minimum iOS Version).
     
  36. Cromfeli

    Cromfeli

    Joined:
    Oct 30, 2014
    Posts:
    198
    Strange if AR Foundation support on device are assumed to be compulsary that would be wild for try to deploy for device limitations like older devices?
     
  37. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,423
    Hi
    I need to mimic the marker + extended tracking feature that Vuforia has, but using latest ARFoundation instead.

    Would I simply be using ARKit's Image tracking feature?

    Also, any tips on a updating a 3 year old Unity 5.6 Vuforia based project to latest version of would be appreciated!
     
    Last edited: Dec 10, 2019
  38. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    168
    Documentation for image tracking in AR Foundation may be found here:
    https://docs.unity3d.com/Packages/c...?subfolder=/manual/tracked-image-manager.html
    https://docs.unity3d.com/Packages/c...@latest?subfolder=/manual/image-tracking.html

    Additionally, the AR Foundation samples project contains an example scene that does image tracking.
    https://github.com/Unity-Technologies/arfoundation-samples
     
  39. Invent4

    Invent4

    Joined:
    Aug 20, 2012
    Posts:
    14
    Hi,

    I'm using Unity2019.2.16f1, ARFoundation 3.1.
    Since I've updated the ARFoundation (from v2.2), I'm having problems detecting the Toch.Began, which starts a simple Physics.Raycast.

    It was working okay in previous version, and the function was being called in the "Update" cycle. Using the AR 3.1, the function stopped to work. Calling it in the "FixedUpdate" cycle I have some result, but not always. It's strange, but it seems that sometimes it don't get the Touch.Began (my guess).
    It's probably related with the cycles sync.

    Any hints on the subject would be appreciated.
    Thanks.
     
  40. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    168
    AR Foundation does not affect the UnityEngine.Input.GetTouch() functionality.
     
  41. samuelmorais

    samuelmorais

    Joined:
    Aug 3, 2012
    Posts:
    51
    Hi,

    In ARFoundation 3, can I load ARKit 3d object tracking ".arobject" file at runtime?
     
    steampunkdigital likes this.
  42. Invent4

    Invent4

    Joined:
    Aug 20, 2012
    Posts:
    14
    Regarding the error I mentioned, I solved the problem calling my function in the "LateUpdate" cycle.

    Still seems to me that it can be some cycle sync problem, my function is based only on the following events

    if (Input.touches[0].phase == TouchPhase.Began)
    if (Input.touches[0].phase == TouchPhase.Moved)

    and have some strange behaviour when calling from Update or FixedUpdate.

    Anyway, thank you, the advances with the ARFoundation 3.1 are great!
     
  43. steampunkdigital

    steampunkdigital

    Joined:
    Nov 3, 2016
    Posts:
    1
    I'd like to confirm this too. Seemed the object tracking functionality was pulled from ARFoundation 3.0.x?
     
    samuelmorais likes this.
  44. scihuman

    scihuman

    Joined:
    Nov 16, 2012
    Posts:
    28
    Has anyone loaded anchors from an ARKIT WorldMap?
     
  45. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    168
  46. dheerajbhati01

    dheerajbhati01

    Joined:
    Dec 19, 2019
    Posts:
    1
    object tracking not working in ar foundation 3.0.1 ?
     
  47. samuelmorais

    samuelmorais

    Joined:
    Aug 3, 2012
    Posts:
    51
    You need to import 3.1.0-preview.1, as stated below by @todds_unity
     
  48. samuelmorais

    samuelmorais

    Joined:
    Aug 3, 2012
    Posts:
    51
    Hi @todds_unity , is object tracking going to have the same feature as image tracking ("Adding new reference image at runtime")? I asked this here before, but didn't receive an answer by Unity yet.
    I am working in an AR authoring tool that needs to add object tracking reference objects at runtime, but we are stuck with ARKIT 2.0 because it is possible only with UnityARKitPlugin (deprecated) and not with ARFoundation.
     
  49. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    168
    The API allows you to change out, at runtime, the entire reference object library for a new one. See the ARTrackedObjectManager.referenceLibrary property.
    https://docs.unity3d.com/Packages/c...ation_ARTrackedObjectManager_referenceLibrary

    However, the ability to change out add a single object to an existing object library does not exist yet.
     
  50. mistergreen2016

    mistergreen2016

    Joined:
    Dec 4, 2016
    Posts:
    215
    Any update on ARCore cloud anchor? I'm using ARKit world mapping now and wondering if ARCore cloud anchor is available. It would be good if ARFoundation would use crossplatform serialize worldmapping.
     
    Last edited: Jan 5, 2020
unityunity