コード例 #1
0
 void OnDestroy()
 {
     MLHands.Stop();
     MLInput.Stop();
     MLWorldPlanes.Stop();
     MLWorldRays.Stop();
 }
コード例 #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;

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

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

            return(false);
        }
コード例 #3
0
ファイル: Planes.cs プロジェクト: yeonhwanp/CFG-XR-Project
 /// <summary>
 /// Stops and destroys plane polling
 /// </summary>
 void OnDisable()
 {
     if (MLWorldPlanes.IsStarted)
     {
         MLWorldPlanes.Stop();
     }
 }
コード例 #4
0
 // Start is called before the first frame update
 void Start()
 {
     if (!MLWorldPlanes.Start().IsOk)
     {
         Debug.LogWarning("MLPlanes failed to start correctly");
     }
 }
コード例 #5
0
        //Init:
        private void Start()
        {
            Initialize();

            //start planes:
            MLWorldPlanes.Start();
            GetPlanes();
        }
コード例 #6
0
 /// <summary>
 /// Initializes variables and makes sure they started correctly
 /// </summary>
 void OnEnable()
 {
     if (!MLWorldPlanes.Start())
     {
         Debug.LogError("Error Planes starting MLWorldPlanes, disabling script.");
         enabled = false;
         return;
     }
 }
コード例 #7
0
    void RequestPlanes()
    {
        _queryParams.Flags = QueryFlags;
        _queryParams.MaxResults = 100;
        _queryParams.BoundsCenter = BBoxTransform.position;
        _queryParams.BoundsRotation = BBoxTransform.rotation;
        _queryParams.BoundsExtents = BBoxExtents;

        MLWorldPlanes.GetPlanes(_queryParams, OnReceivedPlanes);
    }
コード例 #8
0
    void RequestPlanes()
    {
        // Update the query parameters.
        _queryParams.Flags          = QueryFlags;
        _queryParams.BoundsCenter   = cameraTransform.position;
        _queryParams.BoundsRotation = cameraTransform.rotation;
        _queryParams.BoundsExtents  = boundsExtents;

        // Make planes request with parameter list.
        MLWorldPlanes.GetPlanes(_queryParams, HandleOnReceivedPlanes);
    }
コード例 #9
0
ファイル: Planes.cs プロジェクト: yeonhwanp/CFG-XR-Project
        /// <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;
            }
        }
コード例 #10
0
    void Start()
    {
        // Start Planes.
        MLWorldPlanes.Start();

        // The max number of planes returned by the query.
        _queryParams.MaxResults = 1;

        // Set the Planes Request to repeat every 5 secs.
        InvokeRepeating("RequestPlanes", 1f, 5f);
    }
コード例 #11
0
        //Private Methods:
        private void GetPlanes()
        {
            MLWorldPlanesQueryParams query = new MLWorldPlanesQueryParams();

            query.MaxResults     = 50;
            query.MinPlaneArea   = .5f;
            query.Flags          = MLWorldPlanesQueryFlags.SemanticWall | MLWorldPlanesQueryFlags.SemanticFloor | MLWorldPlanesQueryFlags.SemanticCeiling;
            query.BoundsCenter   = _mainCamera.position;
            query.BoundsRotation = _mainCamera.rotation;
            query.BoundsExtents  = _planesQueryBoundsExtents;
            MLWorldPlanes.GetPlanes(query, HandlePlanes);
        }
コード例 #12
0
ファイル: PlaneFinding.cs プロジェクト: anshulcgm/HackVR2018
 private void Start()
 {
     MLWorldPlanes.Start();
     Debug.Log("Started MLWorldPlanes");
     //requestPlanes();
     //List<float> distancesNonFloorPlanes = new List<float>();
     //Debug.Log("Above floors list has " + _aboveFloorList.Count + " planes");
     //for(int i = 0; i < _aboveFloorList.Count; i++)
     //{
     //	distancesNonFloorPlanes.Add(Vector3.Distance(Camera.main.transform.position, _aboveFloorList[i].transform.position));
     //}
     //int minValueIndex = distancesNonFloorPlanes.IndexOf(distancesNonFloorPlanes.Min());
     //playerInstantiationPosition = _aboveFloorList[minValueIndex].transform.position;
 }
コード例 #13
0
ファイル: PlaneFinding.cs プロジェクト: anshulcgm/HackVR2018
    private void requestPlanes()
    {
        //Sets parameters for planes searching
        //Debug.Log("Requesting planes");
        _params.Flags         = queryFlags;
        _params.MaxResults    = 100;
        _params.BoundsCenter  = boundingBoxTransform.position;
        _params.BoundsExtents = boundingBoxExtents;

        Debug.Log("Query params are " + _params.ToString());
        Debug.Log("Trying to get planes");
        //Callback to HandleReceivedPlanes
        MLWorldPlanes.GetPlanes(_params, HandleReceivedPlanes);
        Debug.Log("Finished GetPlanes() method");
    }
コード例 #14
0
    void Awake()
    {
        MLResult result = MLWorldPlanes.Start();

        if (!result.IsOk)
        {
            Debug.LogError("Error Planes starting MLWorldPlanes, disabling script.");
            enabled = false;
            return;
        }
        var queryParams = new MLWorldPlanesQueryParams();
        var queryFlags  = MLWorldPlanesQueryFlags.Horizontal;

        queryParams.Flags          = queryFlags;
        queryParams.MaxResults     = MAX_RESULTS;
        queryParams.BoundsCenter   = BBoxTransform.position;
        queryParams.BoundsRotation = BBoxTransform.rotation;
        queryParams.BoundsExtents  = BBoxExtents;
        MLWorldPlanes.GetPlanes(queryParams, HandleOnReceivedPlanes);
    }
コード例 #15
0
    void Awake()
    {
        MLResult hResult  = MLHands.Start();
        MLResult iResult  = MLInput.Start();
        MLResult pResult  = MLWorldPlanes.Start();
        MLResult wrResult = MLWorldRays.Start();

        if (
            !hResult.IsOk ||
            !iResult.IsOk ||
            !pResult.IsOk ||
            !wrResult.IsOk
            )
        {
            Debug.LogError("Error starting ML APIs, disabling script.");
            enabled = false;
            return;
        }

        // HANDS
        var enabledPoses = new MLHandKeyPose[] {
            MLHandKeyPose.Fist,
        };

        MLHands.KeyPoseManager.EnableKeyPoses(enabledPoses, true);

        // INPUT
        _iController = MLInput.GetController(MLInput.Hand.Left);

        // WORLD PLANES
        var queryParams = new MLWorldPlanesQueryParams();
        var queryFlags  = MLWorldPlanesQueryFlags.Horizontal | MLWorldPlanesQueryFlags.SemanticFloor;

        queryParams.Flags      = queryFlags;
        queryParams.MaxResults = WP_MAX_PLANES;
        MLWorldPlanes.GetPlanes(queryParams, HandleOnReceivedPlanes);

        // WORLD RAYS
        _wrBaseHeight      = transform.position.y;
        _wrLastCentimeters = (int)Math.Truncate(_wrBaseHeight * 100);
    }
コード例 #16
0
ファイル: Planes.cs プロジェクト: yeonhwanp/CFG-XR-Project
        /// <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);
        }
コード例 #17
0
 // Start is called before the first frame update
 void Start()
 {
     // Start Plane Extraction
     MLWorldPlanes.Start();
 }
コード例 #18
0
 /// <summary>
 /// Stops and destroys plane polling
 /// </summary>
 void OnDisable()
 {
     MLWorldPlanes.Stop();
 }
コード例 #19
0
 private void OnDestroy()
 {
     MLWorldPlanes.Stop();
 }
コード例 #20
0
 // Use this for initialization
 void Start()
 {
     MLWorldPlanes.Start();
     PlanePrefab.SetActive(false);
 }
コード例 #21
0
 void onDestroy()
 {
     // Stop Plane Extraction
     MLWorldPlanes.Stop();
 }
コード例 #22
0
 // Use this for initialization
 void Start()
 {
     MLWorldPlanes.Start();
 }