Ejemplo n.º 1
0
        private void Start()
        {
            // Make sure we have all the components in the scene we need.
            anchorManager = WorldAnchorManager.Instance;
            if (anchorManager == null)
            {
                Debug.LogError("This script expects that you have a WorldAnchorManager component in your scene.");
            }

            spatialMappingManager = SpatialMappingManager.Instance;
            if (spatialMappingManager == null)
            {
                Debug.LogError("This script expects that you have a SpatialMappingManager component in your scene.");
            }

            if (anchorManager != null && spatialMappingManager != null)
            {
                anchorManager.AttachAnchor(this.gameObject, SavedAnchorFriendlyName);
            }
            else
            {
                // If we don't have what we need to proceed, we may as well remove ourselves.
                Destroy(this);
            }
        }
Ejemplo n.º 2
0
        // Called by GazeGestureManager when the user performs a tap gesture.
        public void OnSelect()
        {
            // On each tap gesture, toggle whether the user is in placing mode.
            placing = !placing;

            // If the user is in placing mode, display the spatial mapping mesh.
            if (placing)
            {
                foreach (Rigidbody rb in this.GetComponentsInChildren <Rigidbody>())
                {
                    rb.isKinematic = true;
                }
                spatialMappingManager.DrawVisualMeshes = true;

                Debug.Log(gameObject.name + " : Removing existing world anchor if any.");

                anchorManager.RemoveAnchor(gameObject);
            }
            // If the user is not in placing mode, hide the spatial mapping mesh.
            else
            {
                spatialMappingManager.DrawVisualMeshes = false;
                // Add world anchor when object placement is done.
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
                foreach (Rigidbody rb in this.GetComponentsInChildren <Rigidbody>())
                {
                    rb.isKinematic = false;
                }
            }
        }
Ejemplo n.º 3
0
        public void OnInputClicked(InputEventData eventData)
        {
            // On each tap gesture, toggle whether the user is in placing mode.
            placing = !placing;

            // If the user is in placing mode, display the spatial mapping mesh.
            if (placing)
            {
                spatialMappingManager.DrawVisualMeshes = true;

                Debug.Log(gameObject.name + " : Removing existing world anchor if any.");

                // * Make sure anchor store is ready. Otherwise you will get "remove anchor called before anchor store is ready" warning.
                if (anchorManager.AnchorStore != null)
                {
                    anchorManager.RemoveAnchor(gameObject);
                }
            }
            // If the user is not in placing mode, hide the spatial mapping mesh.
            else
            {
                spatialMappingManager.DrawVisualMeshes = false;
                // Add world anchor when object placement is done.
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
                // * Automaticaly disable script after being placed.
                this.enabled = false;
            }
        }
Ejemplo n.º 4
0
        // Called by GazeGestureManager when the user performs a tap gesture.
        public void OnSelect()
        {
            // On each tap gesture, toggle whether the user is in placing mode.
            placing = !placing;

            // If the user is in placing mode, display the spatial mapping mesh.
            if (placing)
            {
                spatialMappingManager.DrawVisualMeshes = true;

                Debug.Log(gameObject.name + " : Removing existing world anchor if any.");

                anchorManager.RemoveAnchor(gameObject);

                // 6-WORLD-COORDS - override the focused object so it moves with
                // your gaze as the cursor would
                GestureManager.Instance.OverrideFocusedObject = gameObject;
            }
            // If the user is not in placing mode, hide the spatial mapping mesh.
            else
            {
                spatialMappingManager.DrawVisualMeshes = false;
                // Add world anchor when object placement is done.
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);

                // 6-WORLD-COORDS - enable physics on the bottles now that we
                // are placed. Also, clear overriding the focused object
                //var stack = GetComponentInChildren<StackedBottlesScript>();
                //stack.InitPhysics();
                //GestureManager.Instance.OverrideFocusedObject = null;
            }
        }
Ejemplo n.º 5
0
        // Called by GazeGestureManager when the user performs a tap gesture.
        public void OnSelect()
        {
            if (FurnitureManipulationManager.IsManipulating && !placing)
            {
                return;
            }

            // On each tap gesture, toggle whether the user is in placing mode.
            placing = !placing;

            // If the user is in placing mode, display the spatial mapping mesh.
            if (placing)
            {
                FurnitureManipulationManager.IsManipulating = true;
                spatialMappingManager.DrawVisualMeshes      = true;

                Debug.Log(gameObject.name + " : Removing existing world anchor if any.");

                anchorManager.RemoveAnchor(gameObject);
                source.PlayOneShot(pickupSound);
            }
            // If the user is not in placing mode, hide the spatial mapping mesh.
            else
            {
                FurnitureManipulationManager.IsManipulating = false;
                spatialMappingManager.DrawVisualMeshes      = false;
                // Add world anchor when object placement is done.
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
                source.PlayOneShot(putdownSound);
            }
        }
Ejemplo n.º 6
0
        // Called by GazeGestureManager when the user performs a tap gesture.
        public void OnSelect()
        {
            // On each tap gesture, toggle whether the user is in placing mode.
            placing = !placing;

            // If the user is in placing mode, display the spatial mapping mesh.
            if (placing)
            {
                spatialMappingManager.DrawVisualMeshes = true;

                Debug.Log(gameObject.name + " : Removing existing world anchor if any.");

                anchorManager.RemoveAnchor(gameObject);

                // delegate
                if (PlacingStart != null)
                {
                    PlacingStart.Invoke(gameObject);
                }
            }
            // If the user is not in placing mode, hide the spatial mapping mesh.
            else
            {
                spatialMappingManager.DrawVisualMeshes = false;
                // Add world anchor when object placement is done.
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);

                // delegate
                if (PlacingEnd != null)
                {
                    PlacingEnd();
                }
            }
        }
Ejemplo n.º 7
0
        public void OnInputClicked(InputEventData eventData)
        {
            // On each tap gesture, toggle whether the user is in placing mode.
            placing = !placing;

            // If the user is in placing mode, display the spatial mapping mesh.
            if (placing)
            {
                spatialMappingManager.DrawVisualMeshes = true;

                Debug.Log(gameObject.name + " : Removing existing world anchor if any.");

                anchorManager.RemoveAnchor(gameObject);
            }
            // If the user is not in placing mode, hide the spatial mapping mesh.
            else
            {
                spatialMappingManager.DrawVisualMeshes = false;
                // Add world anchor when object placement is done.
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
            }
        }