List
Instant Tracking - Similar to the instant tracker demo app (with the target plane) in google play store
Posted Date: 2018-02-19 17:21     Edited Date: 2018-02-27 10:29     Writer: inactive

Hello,

How do i Duplicate the target plane ( similar to the MAXST demo app in the playstore,) , which gives the user the approximation of where to place the 3D object on the surface.

I have downloaded the sample code from github, but i could not figure out the instant plane grid. Please could you refer a sample scene for the same.

Thanks and Regards

Posted Date: 2018-02-20 1:40     Edited Date: 2018-02-20 1:40     Writer: inactive

Hello, 

 

Thank you for using MAXST AR SDK.

 

You can figure out the pose by calling StartTracker in Instatnt Tracker.

 

Using the pose, make the grid and texture. 

 

You can change content after displaying grid texture.

 

If the camere lose the pose, it automatically recalling StartTracker.

 

If you have any further questions, please do not hesitate to contact us.

 

- MAXST Support Team

Posted Date: 2018-02-27 10:13     Edited Date: 2018-02-27 10:13     Writer: inactive

Hello,

I tried to excecute your suggestion to best of my knowlege. 

The app keeps crashing on startup, I am using Unity for development. I have attached the code for development.

Please could you guide me.

------------------------------------------------------------------------------------------------------------------------------------------------------------

using UnityEngine;
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using UnityEngine.UI;

using maxstAR;

public class pose5 : MonoBehaviour {

    [SerializeField]

    private bool startTrackerDone = false;
    private bool cameraStartDone = false;
    private bool findSurfaceDone = false;

    public GameObject Target;

    private InstantTrackableBehaviour instantTrackable = null;

    // Use this for initialization
    void Start () {
        instantTrackable = FindObjectOfType<InstantTrackableBehaviour>();

        if (instantTrackable == null)
        {
            return;
        }

        instantTrackable.OnTrackFail();

        TrackerManager.GetInstance().FindSurface();
    }
    
    // Update is called once per frame
    void Update () {

        StartCamera();

        if (!startTrackerDone)
        {
            TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_INSTANT);
            SensorDevice.GetInstance().Start();
            startTrackerDone = true;
                       
        }


        TrackingState state = TrackerManager.GetInstance().UpdateTrackingState();
        TrackingResult trackingResult = state.GetTrackingResult();
        Trackable trackable = trackingResult.GetTrackable(0);
        Matrix4x4 poseMatrix = trackable.GetPose();

        Target.transform.position = MatrixUtils.PositionFromMatrix(poseMatrix);
        Target.transform.rotation = MatrixUtils.QuaternionFromMatrix(poseMatrix);
        Target.transform.localScale = MatrixUtils.ScaleFromMatrix(poseMatrix);

    }

    void StartCamera()
    {
        if (!cameraStartDone)
        {
            Debug.Log("Unity StartCamera");
            ResultCode result = CameraDevice.GetInstance().Start();
            if (result == ResultCode.Success)
            {
                cameraStartDone = true;
                //CameraDevice.GetInstance().SetAutoWhiteBalanceLock(true);   // For ODG-R7 preventing camera flickering
            }
        }
    }
}

--------------------------------------------------------------------------------------------------------------------------------------------------------------I have used a 2D texutre named as "Target" instead of the grid to display on the screen

Posted Date: 2018-02-27 10:29     Edited Date: 2018-02-27 10:29     Writer: inactive

Hi,

Please refer to our suggestions below.

1. Call FindSurface() after StartTracker()

2. Check tracking count by calling trackingResult.GetCount()

   if (trackingResult.Getcount() >0)

   {

       // Do something here to control position, rotation and visibility of aumented object

   }

We will fix app crashing problem at next update.

Thanks

- Maxst support team