List
Maxst AR is looping between OnTrackFail() & OnTrackSuccess()?
Posted Date: 2017-11-29 6:24     Edited Date: 2018-01-31 23:16     Writer: inactive

Hi,
Im using unity 2017.2 and Maxs SDK 3.2.0

I've add a console print "is tracked" inside OnTrackSuccess()

        public override void OnTrackSuccess(string id, string name, Matrix4x4 poseMatrix)
        {
            print("is tracked");
            ....

and "not tracked" inside OnTrackFail()

        public override void OnTrackFail()
        {
            print("not tracked");
            ....

In playmode, the console shows "is tracked" then "not tracked" then "is tracked" and so on when the camera find the tracker.

If i understand correctly, OnTrackSuccess() and OnTrackFail() should be called once each time the camera found or lost the tracker respectively.

Is this a bug or by design? If its a bug, is there any fix for this?

Posted Date: 2017-11-29 7:21     Edited Date: 2017-11-29 7:21     Writer: inactive

It's not a bug. It's purposely designed so.

OnTrackFail() is called every frame even after the target has been found. That's for the purpose of rendering the child GameObjects inactive while the target is temporarily lost. OnTrackSuccess() is called again as soon as the target is regained. 

You can set the way the two functions are called and whether to keep the child GameObjects active or inactive at Update in ImageTrackerSampler.cs as you like.

Posted Date: 2017-11-29 7:31     Edited Date: 2017-11-29 8:05     Writer: inactive

so if i want to call a method once when the target was found, which method or event that i can use? or did i need to write my own method? do you have an example for this?

for example, if i want to play a sound when the camera found the tracker. where can i put the AudioSource.play()?

thank you for your answer.

--Update

i found that i can use int trackingResult.GetCount() to get it work.

but still, is there any other method that i can use?

Posted Date: 2017-11-29 8:39     Edited Date: 2017-11-29 8:39     Writer: inactive

We think there couldn't be a better idea than yours.

Posted Date: 2018-01-30 21:06     Edited Date: 2018-01-30 21:06     Writer: inactive

Hey guys,

Could you explain how the "int trackingResult.GetCount()" method works specifically? I'm new about this.

Like if i want to play a video with another plugin how the code would be, for example?

 

Thanks.

Posted Date: 2018-01-31 22:27     Edited Date: 2018-01-31 22:27     Writer: inactive

Thanks for using our sdk.

The result of TrackingResult.GetCount() means our tracking engine successes to find some target or not.

If the result is 0 it means there is nothing found and if the result is 1 or over 1 then it means someing is found.

We recommend to use unity built-in video player to play your video.

Here is the explanation howto use unity built-in video player.

https://developer.maxst.com/BoardQuestions/Details/176

Thanks

- Maxst support team

Posted Date: 2018-01-31 23:04     Edited Date: 2018-01-31 23:04     Writer: inactive

Thanks guys for your reply. Just have to say congratulations for your amazing work with yours technology. Its just the better that I´ve tryed. We here want to acquire Pro license, but I'm getting some confusion with play and pause video.

If I want to play a livestream video from Unity built-in video player for Android/iOS and then when target is found then play and when the target is lost then video pause.

I presume this is possible. But how can I do that?

 

Thanks guys. That's is very urgent and important for us here!

Posted Date: 2018-01-31 23:13     Edited Date: 2018-01-31 23:16     Writer: inactive

Please refer code snippets below.

if ( trackingResult.GetCount() > 0)

{

  if (!videoPlayer.isPlaying())

  {

     videoPlayer.Play();

  }

}

else

{

  if (videoPlayer.isPlaying())

  {

     videoPlayer.Pause(); // or videoPlayer.Stop() to set postion to 0

  }

}

Could you please make other thread If you have more questions?

Because it is more helpful to give you our support :-)

- Maxst support team