Closed TheNillesen closed 4 years ago
same problem any luck?
sadly no. I really hope that someone will post a solution <3
You have to subscribe to the trackedImagesChanged event. Then iterate over the 'updated', 'added' and 'remove' lists that come in the ARTrackedImagesChangedEventArgs argument. Disable the game objects in the remove list. You can see that here -> https://github.com/Unity-Technologies/arfoundation-samples/blob/master/Assets/Scenes/ImageTracking/TrackedImageInfoManager.cs#L97
Also you can use the tracking state
ARTrackedImage trackedImage = eventArgs.updated[i];
if (trackedImage.trackingState == TrackingState.Tracking)
Here some info -> https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@2.1/api/UnityEngine.XR.ARFoundation.ARTrackedImageManager.html
Thank you so much, i will check that out first thing in the morning and see if i can figure it out, i´m just gonna wait a bit with closing this issue until i know i don´t have anymore questions.
Again, thank you.
I'm facing the same issue: when the camera is off the target (or even when the target is physically removed) the ARTrackedImage
is not present in the ARTrackedImagesChangedEventArgs
's removed
list and the trackingState
does not go to None
as expected.
i cant make it work either, when i debug i can see that the image is added to the added List.
and i can follow it through the updated list. but i cant do anything with the removed list.
Please someone add a specific example on how to achieve this.
as the image shows - when i have a bad angle on the target i can get the Limited
trackingstate
. but when i just remove my phone completely from the image i get all these errors instead of the None
myTrackedImageInfoManager.txt
This is my script if oyu want to review what i have done
@TheNillesen that's weird, I have not seen those errors... but they might be something else, if you notice the tag is native
and not Unity
...
I get the None
state only when I totally cover the smartphone sensors and let it lose the tracking of the environment
hm you might be right, the error just only occured when i didnt scan. oh well.
Had two great programmers looking through my code and the ar foundation code yesterday and they came to the conclusion that the arfoundation is not working as intended and we might have to wait on a fix. so i am going to use it as it is now (broken) and then hope for a update in the near future so i can update my application.
Will keep this issue open until we get a proper solution.
I'm able to show and hide AR objects using ARFoundation on Android and iOS. Maybe this will help -> https://forum.unity.com/threads/arfoundation-2-image-tracking-with-many-ref-images-and-many-objects.680518/#post-4668326
Could you elaborate @dorkbot? The code that you linked is not able to hide AR objects, they will stay there even if you stop focusing the image or if you physically remove the image... that's the issue
Incorrect, the code I shared does hide the AR object when image tracking is lost. The code I link to is my code (I'm SpiderJones). I have an app that uses playing cards for images. It's live in the Apple App store and I'm using ARFoundation image tracking. https://apps.apple.com/app/id1468426395?fbclid=IwAR2EBeeOOQBa4PLiQt90OBb48hdwZNTae51M7HE2Sg-gKyKlYYbzpxwZzss
I doubt you had enough time to give the approach a try so I don't understand why you would say it doesn't hide objects.
I should point out that my app has an image tracking AR experience and a planar AR experience. Using ARFoundation for both.
I downloaded your app @dorkbot and it actually works, I am quite confused how is it possible with the code you shared on the forum... because that's the same exact code I am using and that the AR Foundation sample uses. The trackingState
never goes to None
in my tests.
Have you set up something on the manager? Or on the library?
(I am using Unity 2019.2.0b1 with AR Foundation preview.3 2.1.0)
I'm using Unity 2019.1.7f and ARFoundation 2.1.0 preview.3. Are you also using the remove List?
Yes but the images are in the remove
list only when the AR Session is stopped
could it be that the ARKit is just working better than the ARCore ?? I played around with it and my image is in fact being disabled, but only when i totally black my camera. or like Oneiros90 said, facing the phone to the table. my guess is that ARCore simple is worse at detecting the trackingstate than arkit..
I agree that ARCore's tracking is far worse than ARKit's one... but the issue I described is present in both systems
okay then. i am far from happy with how this works and even though dorkbot helped a lot i still feel i am missing a crucial part. :(
I'm currently experiencing the same issue: Tracked images never get into the trackingState.limited (or trackingState.None for that matter) and remain in the trackingState.tracked. Only covering the camera results in a change to trackingState.limited. I don't think that's supposed to work like that?
I'm working with Unity 2019.1.5f1, ARFoundation 2.2 and Android 9.0. Haven't tried iOS yet due to the necessity of iOS 13 and XCode 11.
I really hope for a fix or an explanation for the behavior...
ARCore image tracking and ARKit image tracking are not the same, for one, ARCore doesn't track moving images.
To avoid having to use iOS 13 and XCode 11, use ARFoundation 2.1 and ARKit 2.1. The only new feature in ARFoundation 2.2 and ARKit 2.2 is support for the new iOS and Xcode, both of which aren't released yet, as I know you are most likely aware of.
ARCore image tracking and ARKit image tracking are not the same, for one, ARCore doesn't track moving images.
They added that functionality in ARCore 1.9.0
I'm aware of the requierements of using ARFoundation 2.2 instead of 2.1 with iOS, but that shouldn't influence the experience on an Android device...
Ok guys, here's a test project using Unity 2019.1.7f and ARFoundation 2.1.0 preview.3 that shows the issue. Please @dorkbot have a look at the code if you have any spare time, your help would be very precious :) you're the only one that got it working hahaha
Steps to reproduce the problem:
I apologize for not being clear, ARFoundation image tracking on iOS (ARKit) works as expected. ARFoundation on Android (ARCore) doesn't work as expected. I thought that was partly due to ARCore, but as Roaninho has pointed out, image tracking was introduced to ARCore. So now I'm on your team, I believe there is something wrong with ARFoundation image tracking running on Android.
@Roaninho My point was that you can try ARFoundation image tracking on iOS without using iOS 13 and Xcode 11
@dorkbot does your application (CRISPR-3D) work as expected on Android? I am facing the same issues on both ARKit and ARCore...
No, it doesn't work as expected on Android, but does work perfectly on iOS.
This issue is now fixed, image tracking on Android is working as expected. ARCore XR Plugin 2.2.0 preview 2 fixes this issue.
I discovered that Google's ARCore Unity examples had the same issue and were using an older state. https://github.com/Unity-Technologies/arfoundation-samples/issues/209
This issue is now fixed, image tracking on Android is working as expected. ARCore XR Plugin 2.2.0 preview 2 fixes this issue.
I discovered that Google's ARCore Unity examples had the same issue and were using an older state. #209
@dorkbot which version of AR Foundation plugin to be used so image tracking works fine?
I'm using ARFoundation 2.1.3 ARCore XR Plugin 2.2.0
Thank you all so much for all the help and support. !!!
Hi all. I am looking through the code of TrackedImageInfoManager and ARTrackedImageManager in ARFoundations Image Tracking.
My problem is that i am trying to recieve the same functionality as in vuforia image tracking. (when camera is on the target = show content, when camera is off the target = dont show content) when using the demo scene from arfoundation the content stays on the screen instead of being disabled which results in several objects on top of eachother when i change the image. I am stil fairly new to coding so i have a big problem understanding what is happening, i played around with this standard code from the TrackedImageInfoManager script: //Disable the visual plane if it is not being tracked if (trackedImage.trackingState != TrackingState.None) { planeGo.SetActive(true);
// The image extents is only valid when the image is being tracked trackedImage.transform.localScale = new Vector3(trackedImage.size.x, 1f, trackedImage.size.y);
//// Set the texture var material = planeGo.GetComponentInChildren().material;
material.mainTexture = (trackedImage.referenceImage.texture == null) ? defaultTexture : trackedImage.referenceImage.texture;
}
else
{
planeGo.SetActive(false);
}
My problem is that even when the trackingstate is None - the content is still showing..what can i do to make the stuff disapear, and only show when i scan my images?
please help, have been stuck for too long