Log in or register to post comments

How to manage Frame Markers dynamically?

May 24, 2011 - 2:16pm #1

Hi everybody!
Can I add Frame Markers dynamically to my app? I mean, I would like to be able to register/unregister Frame Markers at run-time in order to track them. The easiest way to do this is by adding manually all Frame Markers in my Unity project, but isn´t a nice way.

Thanks a lot! Sorry for my english

Re: How to manage Frame Markers dynamically?

May 26, 2011 - 6:57am #4

You should update to the 1.0 version of the QCAR Unity Extension. We are now out of beta, and are no longer supporting beta versions of the extension.

Can you tell us what your use case is here? Now that I look at it, what you are attempting isn't currently supported (although you can probably hack it in). Let us know what your goal is and we'll look into adding support in a future update. Thanks!

- Kim

Re: How to manage Frame Markers dynamically?

May 25, 2011 - 3:25am #3

First of all, I´m working with Beta 2 Unity Extension, and maybe Marker Behaviour Script is in QCAR Unity 1.0.

What I do is to comment StructToFile(..) method in ConfigParser script. But that´s not enough. Markers have to be registered, and this can be done by calling RegisterTrackable() in TrackerScript manually.

I do these steps to achieve the target:

prefab = (GameObject)Instantiate(Resources.Load("FrameMarker"));
TrackableScript ts = prefab.GetComponent("TrackableScript") as TrackableScript;
TrackerScript trackerScript = (TrackerScript) FindObjectOfType(typeof(TrackerScript));
ts.MarkerID = 45;
ts.trackableType = TrackableScript.TrackableType.FrameMarker;
ts.TrackableName = "mymarker45";

Am I in the right way? How can I associate a mesh (3d object) to the Markers now?

I hope you understand me. Thanks!

Re: How to manage Frame Markers dynamically?

May 24, 2011 - 6:51pm #2

They need to be in the config file, but luckily this doesn't really come at a performance cost (markers are cheap to detect). You can have all 512 markers in the config file at once.

With Unity, you don't actually have to drag out a FrameMarker prefab for each marker. Instead, select the FrameMarker prefab and look at the Inspector. Right-click on the Marker Behaviour script and choose Advanced Settings. Uncheck Marker Synchronization. Now you can add all the markers to the StreamingAssets/QCAR/config.xml file by hand, and they won't be overwritten.

I'm attaching a config file with the first 256 markers listed to get you started (rename to config.xml).

- Kim

Log in or register to post comments