Log in or register to post comments

Static Text as a trackable?

April 24, 2014 - 8:21am #1

Hello forum,

I think I forgot a subject in my first post, and it vanished into the ether.  Fortunately I think I figured out that first issue on my own.

My current project has three image targets that are photos of business cards.  I’m trying to get static text to appear when the one of the targets is in view.  That is text that would appear in the upper corner of the camera view, but only when the image target is visible. 

At the moment I have text that moves with image targets.  But sometimes when the target has been removed from view, the text is still there.  Is there any way to make the trackable(?) disappear when the target is gone?   I’m not sure if this is the default behavior and it should be just working, or if there’s something specific I need to setup to make it function that way.  

Any advice appreciated.

Static Text as a trackable?

April 29, 2014 - 8:54am #4


Thanks for your reply.  I had a feeling what I was looking for would be in the DefaultTrackableEventHandler script.  But I wasn't completely sure.

I'd also made an assumption that when I used the ImageTarget from the Predefined, that code to make trackable components appear and disappear would already be included in the script.  But comparing my script to the one in the example I can see that this is not entirely true.

Static Text as a trackable?

April 28, 2014 - 5:35am #3

I still need to figure out how to enable my text when one of my Image Targets has been found

You could (and should) use the ITrackableEventHandler interface, which has an OnTrackableStateChanged() callback method which is called whenever a Target is found or lost (pretty much what you need);

this is explained in the developer guide, and also illustrated in the sample 

(see the DefaultTrackableEventHandler.cs for a good example of it in the FrameMarkers or the MultiTargets Vuforia sample).


Vuforia has a C# API, so the relavnt Vuforia app code should be written n C#;  how to bind this to your Javascript code is up to you...


Static Text as a trackable?

April 24, 2014 - 11:09am #2

Progress follow up:

I'm not yet able to toggle GUI Text with a trackable image, but after some work I've got it working with a key press.


My js

public var myGUIText:GUIText;
    myGUIText.enabled = true;
    function Update () {
if (Input.GetKeyDown(KeyCode.Space))
// toggle visibility:
myGUIText.active = !myGUIText.active;

I could not get this working at first because I didn't know to drag my actual GUI Text object into script component in the inspector. 

At first it would only toggle off once, because I had associated the script with the GUI Text itself rather than with the AR camera. 

With the GUI Text Script component in the AR Camera Inspector and the actual GUI Text object dragged into the script component; It Works! 

I still need to figure out how to enable my text when one of my Image Targets has been found.   Any thoughts?



Log in or register to post comments