Log in or register to post comments

Instantiating gameobjects in an Image Target at runtime

March 10, 2019 - 4:52pm #1

Hi, I am using Vuforia 8.0, with Unity 2018.3.6.1f.

I am making a building system, with AR, meaning I need to instantiate objects into an image target during run time, however when I do this through a script, this does simply not happen, even after the gameobject is a child of the respective image target.

I have tried to recall the OnTrackingFound() function in the DefaultTrackableEventHandler script after the gameobject has been instantiated in hopes that will re-render all of the childed gameobjects of the image target, however this did not work.

If anyone knows a method I can use to instantiate game objects into an image target during runtime it would be much appreciated

 

thanks.

Instantiating gameobjects in an Image Target at runtime

March 21, 2019 - 5:42am #2

Make sure you position your instantiated prefab with regards to the parent. For instance, if you want the augmentation to in the middle of the ImageTarget, you'd have to set its localPosition to (0, 0, 0) after instantiating it. In the editor, when running the scene, check the scene view to see if the augmentation is actually there but possibly not at the correct position.

The DefaultEventHandler will disable all renderers etc. on child GameObject only if it's not being tracked. See if tracking works correctly by placing an augmentation on an IT manually first.

Good luck!

Log in or register to post comments