Example #1
0
    /// <summary>
    /// Init the SVO, and launch the thread to enable the tracking
    /// </summary>
    private void ZEDReady()
    {
        FPS = (int)zedCamera.GetRequestedCameraFPS();
        if (enableTracking)
        {
            trackerThread = new Thread(EnableTrackingThreaded);
            trackerThread.Start();
        }

        if (zedSVOManager != null)
        {
            if (zedSVOManager.record)
            {
                if (zedCamera.EnableRecording(zedSVOManager.videoFile, zedSVOManager.compressionMode) != sl.ERROR_CODE.SUCCESS)
                {
                    zedSVOManager.record = false;
                }
            }

            if (zedSVOManager.read)
            {
                zedSVOManager.NumberFrameMax = zedCamera.GetSVONumberOfFrames();
            }
        }


        if (enableTracking)
        {
            trackerThread.Join();
        }

        if (isStereoRig && UnityEngine.XR.XRDevice.isPresent)
        {
            ZEDMixedRealityPlugin.Pose pose = ar.InitTrackingAR();
            originPosition           = pose.translation;
            originRotation           = pose.rotation;
            zedRigRoot.localPosition = originPosition;
            zedRigRoot.localRotation = originRotation;

            if (!zedCamera.IsHmdCompatible && zedCamera.IsCameraReady)
            {
                Debug.LogWarning("WARNING : AR Passtrough with a ZED is not recommended. You may consider using the ZED-M, designed for that purpose");
            }
        }
        else
        {
            originPosition = initialPosition;
            originRotation = initialRotation;
        }



#if UNITY_EDITOR
        UnityEditor.EditorApplication.playmodeStateChanged = HandleOnPlayModeChanged;
#endif
    }
Example #2
0
    /// <summary>
    /// Init the SVO, and launch the thread to enable the tracking
    /// </summary>
    private void ZEDReady()
    {
        if (enableTracking)
        {
            trackerThread = new Thread(EnableTrackingThreaded);
            trackerThread.Start();
        }

        if (zedSVOManager != null)
        {
            if (zedSVOManager.record)
            {
                if (zedCamera.EnableRecording(zedSVOManager.videoFile, zedSVOManager.compressionMode) != sl.ERROR_CODE.SUCCESS)
                {
                    zedSVOManager.record = false;
                }
            }

            if (zedSVOManager.read)
            {
                zedSVOManager.NumberFrameMax = zedCamera.GetSVONumberOfFrames();
            }
        }


        if (enableTracking)
        {
            trackerThread.Join();
        }

        if (isStereoRig && UnityEngine.XR.XRDevice.isPresent)
        {
            ZEDMixedRealityPlugin.Pose pose = ar.InitTrackingAR();
            originPosition           = pose.translation;
            originRotation           = pose.rotation;
            zedRigRoot.localPosition = originPosition;
            zedRigRoot.localRotation = originRotation;
        }
        else
        {
            originPosition = initialPosition;
            originRotation = initialRotation;
        }



        AdjustZEDRigCameraPosition();

#if UNITY_EDITOR
        UnityEditor.EditorApplication.playmodeStateChanged = HandleOnPlayModeChanged;
#endif
    }