Log in or register to post comments

Multiple Trackables, one Image Target?

May 11, 2012 - 5:56pm #1

Hi, I have an image target prefab within which I would like multiple 'trackables' to trigger. Is there any way to handle this use case in Unity?

Multiple Trackables, one Image Target?

April 16, 2015 - 1:00pm #14

I tried this but I don't know what to do next?
After detecting the trackable, how do you track it?

Multiple Trackables, one Image Target?

October 12, 2014 - 1:53pm #13

I had the same issue and I solved it with this:

https://developer.vuforia.com/forum/faq/unity-how-do-i-get-list-active-trackables

You basically have only one ImageTarget, then you get the trackables detected by the camera and then instantiate any object you want as a child of your ImageTarget

Hope it helps :)

Multiple Trackables, one Image Target?

October 9, 2014 - 3:34am #12

Hello all, 

Did anyone get a solution for the same.

I am stuck in the same issue. 

 

Please reply with an answer

 

Re: Multiple Trackables, one Image Target?

May 22, 2012 - 5:34am #11
DavidBeard wrote:

I think that you'll be OK running scripts on 20 ImageTarget instances. The event handler registers a callback to receive tracking state change notifications. It's not polling this w/ Update. And keep in mind that there is some cost to destroying and re-instantiating objects as well.

IMO the limiting factor is going to be how many targets you can track and render for simultaneously.

Here's a doc on optimizations for mobile devices running the Unity Player..
http://unity3d.com/support/documentation/Manual/iphone-Optimizing-Scripts.html

Thanks for the clarification. I have tested on over 20 ImageTarget. The framerate is OK since I only have one object to track and render at once.

Re: Multiple Trackables, one Image Target?

May 21, 2012 - 7:32pm #10

I think that you'll be OK running scripts on 20 ImageTarget instances. The event handler registers a callback to receive tracking state change notifications. It's not polling this w/ Update. And keep in mind that there is some cost to destroying and re-instantiating objects as well.

IMO the limiting factor is going to be how many targets you can track and render for simultaneously.

Here's a doc on optimizations for mobile devices running the Unity Player..
http://unity3d.com/support/documentation/Manual/iphone-Optimizing-Scripts.html

Re: Multiple Trackables, one Image Target?

May 21, 2012 - 6:57pm #9

@DavidBeard, I'm not worrying about the number of the dynamically initiated objects in the scene, but is it performance wise to have many ImageTargets script functioning at the same time? When a ImageTarget is detected and attached with actual content, do you think it's necessary to destroy all other ImageTargets?

@pushxtonotdie, I use the same method. I just reparenting "AssetToDisplay" when the OnTrackableFound method in DefaultTrackableEventHandler script is triggered for the first time.

And "AssetToDisplay" doesn't need to be initiated at runtime. They can be a group of large objects that exist in the scene. Just disable all child renderers to make those objects invisible from the beginning. When ImageTarget is detected and they are parented to that ImageTarget, DefaultTrackableEventHandler script will call to activate those renderers.

Re: Multiple Trackables, one Image Target?

May 21, 2012 - 3:30pm #8

Just thought I'd check in. The current technique I'm using is to dynamically reparent the GameObject in a copy of the DefaultTrackableEventHandler. I've created a public var called 'AssetToDisplay' and designers map the instantiated GameObject to this var, so that GameObject A maps to Image Targets BCD and GameObject W can map to XYZ and the designer can control this functionality without issue. This dynamic reparenting occurs like so:

AssetToDisplay.transform.parent = this.gameObject.transform; // [CH] Attach the assets to our parent.

I then loop through the children and start animations, sounds, etc.

This works pretty well but this may not scale to scenes with large numbers of targets and models. This method expects GameObjects to be instantiated at startup. A better approach may be to do as mentioned: instantiate a prefab, but we do not have a lot of content so this is not a big issue for us.

Re: Multiple Trackables, one Image Target?

May 20, 2012 - 8:37am #7

Dynamic instantiation of objects is a commonly used technique in game development - e.g. for spawning characters, etc.. In and of itself, there is not a significant performance penalty. But you should do some testing. Your app's performance will be affected by the rendering complexity of the aggregate collection of objects that your are generating (i.e. up to 20 ).

here's an example of how to accomplish this using Prefabs..
http://unity3d.com/support/documentation/Manual/Instantiating%20Prefabs

Re: Multiple Trackables, one Image Target?

May 20, 2012 - 3:59am #6
DavidBeard wrote:

You're going to have to use multiple ImageTargets for this. You can use transform.parent to handle the parent assignment. And you can simply customize Default Trackable Event Handler if you like. But if you want the object to appear on multiple targets simultaneously, you'll have to clone it.

If I have more than 20 trackables in the scene for a single ImageTarget, will the method destroy the performance?

Re: Multiple Trackables, one Image Target?

May 11, 2012 - 10:22pm #5

OK David! That sounds like a good plan of attack, thanks!

Re: Multiple Trackables, one Image Target?

May 11, 2012 - 6:28pm #4

You're going to have to use multiple ImageTargets for this. You can use transform.parent to handle the parent assignment. And you can simply customize Default Trackable Event Handler if you like. But if you want the object to appear on multiple targets simultaneously, you'll have to clone it.

Re: Multiple Trackables, one Image Target?

May 11, 2012 - 6:20pm #3

Thanks for replying so quickly. I am not attempting to create a Multiple Target. I have three different images, for example, a horse, a bear, and a dog, and when the image is tracked, I have one object that I would like to appear regardless of whether it is a horse, bear, or dog. I would prefer not to have to create three separate image targets and three copies of the object to display.

I have thought about creating my own TrackableEventHandler that would dynamically parent the game objects to the correct Image Target if I have to. I'm assuming this is possible in Unity, but I'm a noob to both unity and vuforia.

Thanks,
C

Re: Multiple Trackables, one Image Target?

May 11, 2012 - 6:02pm #2

A MultiTarget can contain multiple ImageTargets, but these are not recognized independently. Otherwise you'll need to use multiple ImageTargets aligned to form a common image.

Do you need to recognize each ImageTarget independently?

Log in or register to post comments