コード例 #1
0
 /// <summary>
 /// Stops and destroys plane polling
 /// </summary>
 void OnDisable()
 {
     if (MLWorldPlanes.IsStarted)
     {
         MLWorldPlanes.Stop();
     }
 }
コード例 #2
0
 /// <summary>
 /// Stops and destroys plane polling
 /// </summary>
 void OnDestroy()
 {
     if (MLWorldPlanes.IsStarted)
     {
         MLWorldPlanes.Stop();
     }
 }
コード例 #3
0
 /// <summary>
 /// Initializes variables and makes sure they started correctly
 /// </summary>
 void OnEnable()
 {
     MLResult result = MLWorldPlanes.Start();
     if (!result.IsOk)
     {
         Debug.LogErrorFormat("Error: Planes failed starting MLWorldPlanes, disabling script. Reason: {0}", result);
         enabled = false;
         return;
     }
 }
コード例 #4
0
        /// <summary>
        /// Initializes variables and makes sure they started correctly
        /// </summary>
        void OnEnable()
        {
            MLResult result = MLWorldPlanes.Start();

            if (!result.IsOk)
            {
                Debug.LogError("Error Planes starting MLWorldPlanes, disabling script.");
                enabled = false;
                return;
            }
        }
コード例 #5
0
ファイル: Planes.cs プロジェクト: CU-VisuaLab/HydrogenAR
        /// <summary>
        /// Initializes variables and makes sure they started correctly
        /// </summary>
        void OnEnable()
        {
            MLResult result = MLWorldPlanes.Start();

            if (!result.IsOk)
            {
                GameObject.Find("DebugText").GetComponent <Text>().text = result.ToString();
                Debug.LogErrorFormat("Error: Planes failed starting MLWorldPlanes, disabling script. Reason: {0}", result);
                enabled = false;
                return;
            }
        }
コード例 #6
0
        /// <summary>
        /// Queries the Planes API with all of the set query flags and parameters
        /// and sets the Planes[] when finished. Based on the query flags that
        /// are passed in, extraction and calculation times may vary.
        /// </summary>
        private bool QueryPlanes()
        {
            // Construct flag data
            _queryFlags = (MLWorldPlanesQueryFlags)OrientationFlags;
            _queryFlags |= (MLWorldPlanesQueryFlags)SemanticFlags;
            if (InnerPlanes)
            {
                _queryFlags |= MLWorldPlanesQueryFlags.Inner;
            }

            if (IgnoreHoles)
            {
                _queryFlags |= MLWorldPlanesQueryFlags.IgnoreHoles;
            }
            if (OrientToGravity)
            {
                _queryFlags |= MLWorldPlanesQueryFlags.OrientToGravity;
            }

            _queryParams.Flags = _queryFlags;
            _queryParams.BoundsCenter = transform.position;
            _queryParams.MaxResults = MaxPlaneCount;
            _queryParams.BoundsExtents = transform.localScale;
            _queryParams.BoundsRotation = transform.rotation;
            _queryParams.MinHoleLength = MinHoleLength;
            _queryParams.MinPlaneArea = MinPlaneArea;

            MLResult result = MLWorldPlanes.GetPlanes(_queryParams, HandleOnReceivedPlanes);

            if (result.IsOk)
            {
                _isQuerying = true;
                return true;
            }
            // TODO: Print result in failure case while preventing log spam.

            return false;
        }