Log in or register to post comments

How to only activate script with Image Target?

October 15, 2017 - 6:22pm #1

Hi, 

I am creating a project wherein I am spawning a bunch of butterflies over my image target. Instead of copy pasting/cloning the butterflies, I have made use of the flocking scripts instead. However, the script runs automatically regardless of whether the target has been detected or not. How can I make it so that the script only activates upon image target detection? I have read somewhere that you can use OnTrackingFound and OnTrackingLost scripts in the DefaultTrackableHandle, but I am completely new to Unity, Vuforia and coding so if anyone could enlighten me upon the usage of these scripts, or another way to resolve this problem, it would be much appreciated. 

Thank you!

How to only activate script with Image Target?

October 16, 2017 - 9:39am #4

Hello yannylung,

You can modify the script in the post that is linked to start your script instead of setting mShowGUIButton to true in the OnTrackableStateChanged function. If desired, you can also have the script stop when tracking is lost in the same function, but that is dependent on your app's desired behavior.

Thanks,

-Vuforia Support

How to only activate script with Image Target?

October 16, 2017 - 8:54am #3

Hi, thank you for replying! 

Would you care to explain how to edit the code so that it does not pop up a button but starts the script instead? I am new to coding and would appreciate any help or insight you could give.

How to only activate script with Image Target?

October 16, 2017 - 2:42am #2
Log in or register to post comments