I’m working through my first app, and have a simulated environment with image markers placed. Things seem to work OK, but I’m wondering – should the camera be able to lose track of the image marker once it is triggered?
From what I’m seeing, an image marker, once found, is never lost, and never “deactivates”. This prevents markers from “firing again”.
So, how does one, lose, and then re-trigger a simulated image marker? Should this be possible to simulate?
Or more to the point, how do I make it so that my app can lose, and then re-trigger actual image markers when “re-found”?
I have tried the “Reset on loss” toggle. Unfortunately I don’t see that it has any effect. I’m not really sure if the simulator is recognizing that the marker is lost, even if I turn away 180 degrees.
Should a loss state actually deactivate the marker’s children? Because, once the image is found once, it seems to be permanently found. (But then, I still have the un-navigable Device View issue, so I don’t know if the simulated environment is actually working as intended.)
Could you try it out on the device build since there is currently an issue with 2020?; if not, could you test out if it works on 2019.4 LTS? (on 2019.4 device view works correctly)
It seems that Device view will show the simulated environment in Unity 2019.4 if I choose “Environment” as the select type. The it shows up, and the view is navigable.
So, once that is working, I’m kind of back at the original question… should synthetic image markers be capable of resetting once lost? Like the Game view, and the Simulation view, the Device view never seems to lose track of the image, and therefore it only “fires” one time. Does that represent expected behavior?
In the actual application how can I reset an image marker after losing it? Is there an integrated way to get notified of markers found or lost? I guess I’d have expected the “Actions” tab in the proxy’s inspector to offer me a way to send a message to another game object (or script) when these events occur.
How are image marker lost and found supposed to work, beyond enabling the marker’s child objects the first time it is located?
We are looking into the image marker; in the meantime. I am running 2019.4 and can see it working with Content selected. Can you please tell us if you get any errors in the editor log? (not in the unity console, but in the OS Console)
So, if I switch device view to Select Type “Content”, all simulation environment and synthetic image markers disappear. The only thing remaining in the device view is the child object of the image marker.
However, toggling the window’s “run simulation” button (or play button) as well as the select type may make the simulation content appear or disappear. It is consistent, but they are definitely interacting with each other.
Even when the simulated environment, and synthetic markers AND scene content is displayed, AND the device view is navigable – image markers never seem to become lost either through becoming obscured or completely being removed from the camera (user) FOV.
Not really seeing anything written to the OS console, and the Unity console only shows some temporary issues which are clearable.
Those errors look like the initial errors you posted on the 2020 post and that could be affecting the simulation environment behavior. Do you have a set of steps we can try to try to reproduce that nullref?. Also I assume you are using 2019.4.26f1 (latest LTS) correct?
Yes, 2019.4.26f1 (latest LTS) with MARS 1.3.0, under OSX 11.3.1
Build settings are IOS, and the ARKit XR plugin is added through package manager. (although these issues showed with the build at “Current Platform” and no ARKit XR plugin as well.)
Steps to reproduce (as far as I know)…
make a new scene
add MARS session
create a simple image marker library with a few imported images
Assign simple image marker library to mars session
Add an image marker, select one from the assigned library
Add a cube as a child of the image marker
Add a synthetic image marker to the simulation through the mars panel
position the marker
My “actual” scene under Unity 2020 is quite a bit more involved, but all the problems I’m dealing there with show up with the above recipe.
Confirmed, adding a tracking state condition set to limited does allow the image track to become appropriately lost.
Is there some way to get notified of the state change? So far I haven’t attempted to script on top of MARS code, as it already acts somewhat unpredictably even without my trying to hack on it. I’m reserving that part until I understand how it is supposed to work in the first place.
What I’d really like is an event or broadcast message to fire that I can easily subscribe to.
yes, Just implement IMatchAcquireHandler and IMatchLossHandler to know if that proxy gets matched or not. Just add this script to your proxy with the tracking state condition and you will see it printing on the console when It gets matched and goes lost.
using Unity.MARS.Query;
using UnityEngine;
public class CheckTracking : MonoBehaviour, IMatchAcquireHandler, IMatchLossHandler
{
public void OnMatchAcquire(QueryResult queryResult)
{
Debug.Log("Image marker Matched!");
}
public void OnMatchLoss(QueryResult queryResult)
{
Debug.Log("Image marker Lost!");
}
}
Thanks for that, it gives me a lot I can explore without trying to understand exactly how to interact with the internals of Mars.
Now, using Game view in Unity 2020, with tracking state conditions, and OnMatchAcquire, I’m getting roughly the behavior I was expecting from the simulation, or Device View. Image Markers are found and lost and found again, and content is appropriately retriggering, so I’m starting to get somewhere.
Certainly looking forward to the Mars 1.3.1 update which I hope makes things more predictable.