- Sort Posts
- 5 replies
- Last post
On Trackable Found ?
On Trackable Found ?
Reviving this.. Can you provide a code snippet for when a trackable is detected (and also identifies which trackable)
It is already included in DefaultTrackableEventHandler.cs, there are methods OnTrackingFound() and OnTrackingLost().
For example:
private void OnTrackingFound() { Renderer[] rendererComponents = GetComponentsInChildren(); // Enable rendering: foreach (Renderer component in rendererComponents) { component.enabled = true; } Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found"); }
This code attached at ARCamera and show the image target name when detected??i try to write a script which when arcamera detect a image target named "win" then run this myGUItext.gameObject.active = true;}
On Trackable Found ?
Reviving this.. Can you provide a code snippet for when a trackable is detected (and also identifies which trackable)
It is already included in DefaultTrackableEventHandler.cs, there are methods OnTrackingFound() and OnTrackingLost().
For example:
private void OnTrackingFound() { Renderer[] rendererComponents = GetComponentsInChildren<Renderer>(); // Enable rendering: foreach (Renderer component in rendererComponents) { component.enabled = true; } Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found"); }
Attach that script to the ImageTarget instance instead. Then you can check for the 'win' target using
if( mTrackableBehaviour.TrackableName.Equals("
win") ){
// do something
}