Log in or register to post comments

Instantiate Image Target Prefabs at runtime

January 25, 2016 - 4:15am #1

Hello everyone,

I think the title is pretty self-explanatory but I'll start describing my problem.

I've a Unity Scene with an ARCamera and different prefabs (in Resources Folder) with different ImageTargets and models within (some prefabs MAY have the same ImageTarget but a surely a different model).

While in Play I need to Instantiate those prefabs (one at a time) and make their ImageTargets work.

 

With this setup already done, ARCamera doesn't recognize any of my imagetarget. The prefabs works if I "Play" the scene with the prefab already in it.

 

Is there a way to make what I want to do? I think I need to initialize the image target at runtime but I can't find how!

 

Thanks and have a nice day,

Davide

 

Instantiate Image Target Prefabs at runtime

January 28, 2016 - 3:18pm #3

Instantiate Image Target Prefabs at runtime

January 26, 2016 - 12:31am #2

Hi,

I want to do the same thing, but I have exactly the same problem. I have test some thing to isolate the problem. 

I have make a unity scene with an ARCamera and an ImageTarget that contains an object, if i play the scene directly all work good, but if I play the scene with deactivate the image target and activate it at runtime the imagetarget does'nt work.

Another test i make, I have build exactly the same scene, but I have add a canvas with a sprite that follow the object inside the imagetarget. If i play the scene directly all wook good, but if I play the scene and activate the image target at runtime, the object doesn't appear but the sprite follow it. 

So, i think, the image target work, Vuforia track it, but it not fire the OnTrackableStateChanged event on the image target. I fact it does'nt enabled the renderer of the object inside the imagetarget, but it update the position of the camera well.

 

Maybe, we need to register the imagetarget to get event OnTrackableStateChanged ? But I don't know how to do that.

I hope this wiil help you.

 

Vianney

Log in or register to post comments