Beispiel #1
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;

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

            if (result)
            {
                _isQuerying = true;
                return(true);
            }

            return(false);
        }
Beispiel #2
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;
        }