Exemple #1
0
        public virtual void OnInputClicked(InputClickedEventData eventData)
        {
            // On each tap gesture, toggle whether the user is in placing mode.
            IsBeingPlaced = !IsBeingPlaced;

            // If the user is in placing mode, display the spatial mapping mesh
            // and remove the frame menu.
            if (IsBeingPlaced)
            {
                canvas.gameObject.transform.GetChild(0).gameObject.SetActive(false);
                canvas.gameObject.transform.GetChild(1).gameObject.SetActive(false);

                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
            // and add the frame menu.
            else
            {
                spatialMappingManager.DrawVisualMeshes = false;
                // Add world anchor when object placement is done.
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
                // Open up the frame menu
                canvas.gameObject.transform.GetChild(1).gameObject.SetActive(true);

                // TO DO: Adjust and anchor frame menu
                //canvas.gameObject.transform.GetChild(1).transform.SetPositionAndRotation(new Vector3() )

                //this.gameObject.transform.GetChild(frame).gameObject.SetActive(true);
            }
        }
    public virtual void OnInputClicked(InputEventData eventData)
    {
        GazeableColorPicker colorPicker = FindObjectOfType <GazeableColorPicker>();

        if (colorPicker != null && colorPicker.IsColoring)
        {
            Color col = colorPicker.PickedColor;
            GetComponentInChildren <Renderer>().material.SetColor("_Color", colorPicker.PickedColor);
            colorPicker.IsColoring = false;
            return;
        }
        // On each tap gesture, toggle whether the user is in placing mode.
        IsBeingPlaced = !IsBeingPlaced;

        // If the user is in placing mode, display the spatial mapping mesh.
        if (IsBeingPlaced)
        {
            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);
        }
    }
Exemple #3
0
        public virtual void OnInputClicked(InputClickedEventData eventData)
        {
            if (GameStateManager.Instance.CurrentGameState != GameState.Configuration && IsBeingPlaced == false)
            {
                Debug.Log("Tap to place is NOT AVAILABLE in GameState.Playing mode");
                return;
            }

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


            // If the user is in placing mode, display the spatial mapping mesh.
            if (IsBeingPlaced)
            {
                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
            {
                InputManager.Instance.PopModalInputHandler();
                spatialMappingManager.DrawVisualMeshes = false;
                IgnoreRaycasts(false);
                // Add world anchor when object placement is done.
                anchorManager.AttachAnchor(gameObject, SavedAnchorFriendlyName);
            }
        }
    public void PlaceAnchor()
    {
        if (curentState != ControlState.Ready)
        {
            ttsMgr.SpeakText("AnchorStore Not Ready");
            return;
        }

        anchorManager.RemoveAnchor(PlacementObject);
        curentState = ControlState.PlaceAnchor;
    }
    public void DetachAnchor()
    {
        if (Id == null)
        {
            Debug.LogError("attempting to detach anchor when its Id isn't set yet");
        }

        worldAnchorManager.RemoveAnchor(gameObject);
        CapsuleRenderer.material = AnchorDetached;
        Debug.Log("-Anchor detached for: " + this.gameObject.name + " - AnchorID: " + Id);
        IsAttached = false;
    }
Exemple #6
0
    public void PlaceAnchor()
    {
        if (CurrentState != ControlState.Ready)
        {
            DisplayUI.Instance.AppendText("AnchorStore Not Ready");
            return;
        }

        anchorManager.RemoveAnchor(PlacementObject);
        CurrentState = ControlState.PlaceAnchor;
        DisplayUI.Instance.AppendText("Anchor Placement Started");
    }
Exemple #7
0
    void OnDestroy()
    {
        WorldAnchorManager anchorManager = WorldAnchorManager.Instance;

        if (anchorManager != null && imageTarget != null)
        {
            anchorManager.RemoveAnchor(imageTarget.name);
        }

        if (imageTarget != null)
        {
            imageTarget.SetActive(true);
        }
    }
Exemple #8
0
        private void Update()
        {
            if (m_appState.CurrentState.Value != HololensAppState.State.Calibrating)
            {
                if (CameraDevice.Instance.IsActive())
                {
                    CameraDevice.Instance.Stop();
                }
            }

            if (m_appState.CurrentState.Value == HololensAppState.State.Running)
            {
                if (m_doCalibrate)
                {
                    for (int i = 0; i < m_appState.FingerTransforms.Count; i++)
                    {
                        m_worldAnchorManager.RemoveAnchor(m_appState.FingerTransforms[i].gameObject);
                        m_appState.FingerTransforms[i].position = Vector3.zero;
                        m_appState.FingerTransforms[i].rotation = Quaternion.identity;
                    }

                    m_appState.CurrentState.Value = HololensAppState.State.Calibrating;

                    m_doCalibrate = false;

                    m_fingerBeingCalibrated = 0;

                    coordinatesObject.SetActive(true);
                    CameraDevice.Instance.Start();
                }
            }

            if (debugText != null)
            {
                string message = "State: " + m_appState.CurrentState.Value.ToString() + "\n";
                if (m_appState.CurrentState.Value == HololensAppState.State.Calibrating)
                {
                    message += "Finger being calibrated: " + m_fingerBeingCalibrated + "\n";
                }

                debugText.text = message;
            }
        }
        /// <summary>
        /// Starts adjusting the target object by enabling the adjustment components.
        /// </summary>
        public void StartAdjusting()
        {
            if (IsAdjusting)
            {
                return;
            }

            SaveTargetTransform();

            if (anchorManager != null && anchorManager.AnchorStore != null)
            {
                Debug.Log(string.Format("Attempting to remove anchor for GameObject : {0}", TargetGameObject.name));
                anchorManager.RemoveAnchor(TargetGameObject);
            }

            EnableAdjustingComponents();
            IsAdjusting = true;
            AdjustingStarted.RaiseEvent();
        }
Exemple #10
0
        public virtual void OnInputClicked(InputEventData eventData)
        {
            // On each tap gesture, toggle whether the user is in placing mode.
            IsBeingPlaced = !IsBeingPlaced;

            // If the user is in placing mode, display the spatial mapping mesh.
            if (IsBeingPlaced)
            {
                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);
            }
        }
Exemple #11
0
 private void RemoveAnchor(InteractionSourceKind sourceKind)
 {
     anchorManager.RemoveAnchor(gameObject);
 }
Exemple #12
0
 public override void OnManipulateStart()
 {
     _baseRot = target.rotation;
     _anchorStore.RemoveAnchor(target.gameObject);
 }
 public void ReleaseAnchor()
 {
     worldAnchorManager.RemoveAnchor(this.gameObject);
     this.gameObject.GetComponent <Renderer>().material.color = Color.green;
 }
        /// <summary>
        /// Starts dragging the object.
        /// </summary>
        public void StartDragging(IsBeingPlacedStates isBeingPlacedBy)
        {
            if (!IsDraggingEnabled)
            {
                return;
            }

            // if already dragging with the same method
            if (IsBeingPlaced == isBeingPlacedBy)
            {
                return;
            }

            // if start dragging
            if (IsBeingPlaced == IsBeingPlacedStates.No)
            {
                // Add self as a modal input handler, to get all inputs during the manipulation
                InputManager.Instance.PushModalInputHandler(gameObject);
            }

            IsBeingPlaced = isBeingPlacedBy;

            Vector3 handPosition;

            if (DraggingMethod != DraggingMethods.TapToPlaceWithGaze &&
                currentInputSource != null &&
                currentInputSource.TryGetPosition(currentInputSourceId, out handPosition))
            {
                Vector3 gazeHitPosition = GazeManager.Instance.HitInfo.point;

                Vector3 handPivotPosition = GetHandPivotPosition();
                handRefDistance = Vector3.Magnitude(handPosition - handPivotPosition);
                objRefDistance  = Vector3.Magnitude(gazeHitPosition - handPivotPosition);

                Vector3 objForward = ObjectToPlace.transform.forward;

                // Store where the object was grabbed from
                objRefGrabPoint = mainCamera.transform.InverseTransformDirection(ObjectToPlace.transform.position - gazeHitPosition);

                Vector3 objDirection  = Vector3.Normalize(gazeHitPosition - handPivotPosition);
                Vector3 handDirection = Vector3.Normalize(handPosition - handPivotPosition);

                objForward    = mainCamera.transform.InverseTransformDirection(objForward);    // in camera space
                objDirection  = mainCamera.transform.InverseTransformDirection(objDirection);  // in camera space
                handDirection = mainCamera.transform.InverseTransformDirection(handDirection); // in camera space

                objRefForward = objForward;

                // Store the initial offset between the hand and the object, so that we can consider it when dragging
                gazeAngularOffset = Quaternion.FromToRotation(handDirection, objDirection);
                draggingPosition  = gazeHitPosition;
            }

            StartedDragging.RaiseEvent();

            if (Placement == PlacementOptions.ForceSpatialMapping)
            {
                if (spatialMappingManager != null)
                {
                    spatialMappingManager.DrawVisualMeshes = DrawVisualMeshes;
                }
            }
            if (EnablePersistenceInWorldAnchor)
            {
                Debug.Log(gameObject.name + " : Removing existing world anchor if any.");
                anchorManager.RemoveAnchor(gameObject);
            }
        }
Exemple #15
0
 public void OnManipulationStarted()
 {
     worldAnchorManager.RemoveAnchor(gameObject);
 }
 public void onPickUp()//when the art is beign moved a spatial anchor is deleted at the store
 {
     MyManager.RemoveAnchor(gameObject);
     Debug.Log("AnchorRemoved");
 }