How to call call the method OnTrackSuccess() only once.
Please provide your development details as below;
1. SDK Version: latest MAXSTARSDK_Unity_4.1.3 from site
2. Development Environment: Unity-Android
3. Tracker/Scanner:Image Tracker
4. License Type:Free
5. Target Device(Optional):Android
Well I am making a game using 4 Image targets. what i want is to call method imageTrackablesMap[trackable.GetName()].OnTrackSuccess(trackable.GetId(), trackable.GetName(), trackable.GetPose()); only once if the image is detected, it should not be repeted within frame.
The sample code currently provided simply displays the content when it is recognized, and uses the OnTrackSuccess function every frame for it. But if you don't want the OnTrackSuccess function to be called every frame, you can simply declare it as a bool type to control whether the content to be augmented is currently shown and controll by an if statement.
bool ContentIsVisible; if(!ContentIsVisible) { OnTrackSuccess(); ContentIsVisible=true; } else { OnTrackFailed(); ContentIsVisible=false; }
Leo
Maxst Support Team
Thanks for the quick reply, I would be glad if you please tell me where to use this code because as far as I know, it gets executed in the update function of ImageTargetSample.cs and it is giving me the same result. I am looking forward to your reply.
Well, if the content is augmented, remember the bool type and don't call OnTrackSuccess. I gave you this simple idea, and you have to implement it yourself. Probably the code I wrote above won't work. You will need to create an if statement with a little bit more condition. The forums are where SDK questions are asked, so we don't teach you these implementations. If statement is not difficult, I recommend you to make it yourself.
Leo
Maxst Support Team