Log in or register to post comments

Dynamic MT dataset load with OnTargetFound

June 8, 2020 - 9:02am #1

Hello, 



I am loading the model target data set dynamically. The data set loads and activates and detects the target. And then am attaching the DefaultTrackableEventHandler script to get the OnTargetFound Unity Event. The Addlistener for the event throws a null reference exception. 



Also, when the  "New Game Object" instantiates, which has the ModelTargetBehaviour script attached. On clicking the object in the hierarchy the following error occurs. Image attached:

AttachmentSize
Image icon Dataset(dat) Error.png177.8 KB

Dynamic MT dataset load with OnTargetFound

November 27, 2020 - 10:49pm #5

great work thank you so much a lot Empires and Puzzles Hack

Dynamic MT dataset load with OnTargetFound

June 10, 2020 - 5:02am #4

Hi,

In the Core Sample apps, we do exactly that, load 2 different datasets, Standard and Advanced. Depending on the UI option selected we deactivate and activate them.

Please go over our implementation, to be more specific: ModelTargetsManager.cs script.

Thank you.

Vuforia Engine Support

Dynamic MT dataset load with OnTargetFound

June 9, 2020 - 8:43am #3

Hi,



Yes for me the DefaultTrackbleEventHandler is not attached by default.

I am using the code I found from the forum.

This is the link of the query I found the code from.



https://developer.vuforia.com/forum/model-targets/dynamically-loading-and-activating-datasets

And I am also attaching the file mentioned in the forum.

I have tried the Vuforia Core Samples, but the scenario is: 

The dataset is downloaded from a server and loaded using VuforiaUnity.StorageType.STORAGE_ABSOLUTE. All at runtime.

When the dataset loads and activates, Vuforia is creating a new gameobject called "New GameObject" which has only the ModelTargetBehaviour script attached. To get OnTargetFound event, I am manually attaching  DefaultTrackbleEventHandler script which is giving me null.



Can you guide me to what is the correct way to load the MT dataset dynamically to get this event on detection.

AttachmentSize
Plain text icon LoadDataset.txt2.72 KB

Dynamic MT dataset load with OnTargetFound

June 9, 2020 - 7:22am #2

Hi,

In the Core Sample app we have the ModelTargetBehaviour running with the DefaultTrackableEventHandler and you have the option OnTrackingFound().

Please review our Core Sample app on how we implemented it.

Also you do not need to attach the DefaultTrackableEventHandler to the MT as it is already present when you create the MT GameObject. Maybe this is why you get this errors.

Thank you.

Vuforia Engine Support

 

Log in or register to post comments