コード例 #1
0
        //Private Methods:
        private bool LookingAtFloorDetermination()
        {
            //cast to see if we are looking at the floor:
            RaycastHit hit;

            if (Physics.Raycast(_mainCamera.position, _mainCamera.forward, out hit))
            {
                SurfaceType surface = SurfaceDetails.Analyze(hit);
                if (surface == SurfaceType.Floor)
                {
                    Location        = hit.point;
                    _placementValid = true;
                    return(true);
                }
                else
                {
                    _placementValid = false;
                    return(false);
                }
            }
            else
            {
                _placementValid = false;
                return(false);
            }
        }
コード例 #2
0
        //Init:
        private IEnumerator Start()
        {
            HideGUI();

            //refs:
            _camera = Camera.main.transform;

            //sets:
            _cachedPrimaryWallGUIScale = selectPrimaryWallGUI.transform.localScale;

            //features:
            MLPersistentCoordinateFrames.Start();
            MLPlanes.Start();
            MLInput.Start();

            //wait for service startup:
            Debug.Log("Waiting for PersistentCoordinateFrames service to localize...");
            while (!MLPersistentCoordinateFrames.IsLocalized)
            {
                yield return(null);
            }
            Debug.Log("PersistentCoordinateFrames service localized!");

            //hooks:
            MLPersistentCoordinateFrames.OnLocalized        += HandleOnLocalized;
            MLPersistentCoordinateFrames.PCF.OnStatusChange += HandlePCFChanged;

            //requirements:
            _surfaceDetails = FindObjectOfType <SurfaceDetails>();
            if (_surfaceDetails == null)
            {
                _surfaceDetails = gameObject.AddComponent <SurfaceDetails>();
            }

            if (runAtStart)
            {
                Create();
            }
        }