private void GestureRecognizer_TappedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
    {
        GazeManager gm = GazeManager.Instance;

        if (gm.IsGazingAtObject)
        {
            // Get the target object
            GameObject obj = gm.HitInfo.collider.gameObject;

            // Try and get a TTS Manager
            TextToSpeechManager tts = null;
            if (obj != null)
            {
                tts = obj.GetComponent <TextToSpeechManager>();
            }

            // If we have a text to speech manager on the target object, say something.
            // This voice will appear to emanate from the object.
            if (tts != null && !tts.IsSpeaking())
            {
                // Get the name
                var voiceName = Enum.GetName(typeof(TextToSpeechVoice), tts.Voice);

                // Create message
                var msg = string.Format("This is the {0} voice. It should sound like it's coming from the object you clicked. Feel free to walk around and listen from different angles.", voiceName);

                // Speak message
                tts.SpeakText(msg);
            }
            else if (tts.IsSpeaking())
            {
                tts.StopSpeaking();
            }
        }
    }
Exemple #2
0
    void OnTapped(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
    {
        // If we're networking...
        if (SharingStage.Instance.IsConnected)
        {
            // Make a new cube that is 2m away in direction of gaze but then get that position
            // relative to the object that we are attached to (which is world anchor'd across
            // our devices).
            var newCubePosition =
                this.gameObject.transform.InverseTransformPoint(
                    (GazeManager.Instance.GazeOrigin + GazeManager.Instance.GazeNormal * 2.0f));

            // Use the span manager to span a 'SyncSpawnedObject' at that position with
            // some random rotation, parent it off our gameObject, give it a base name (MyCube)
            // and do not claim ownership of it so it stays behind in the scene even if our
            // device leaves the session.
            this.spawnManager.Spawn(
                new SyncSpawnedObject(),
                newCubePosition,
                Random.rotation,
                this.gameObject,
                "MyCube",
                false);
        }
    }
Exemple #3
0
    private void NavigationRecognizer_NavigationCanceledEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 relativePosition, Ray ray)
    {
        //   ReleasedEvent.Invoke();

        // 2.b: Set IsNavigating to be false.
        IsNavigating = false;  // NOT EITHER
    }
Exemple #4
0
    private void ScaleRecognizer_ScaleCompletedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 relativePosition, Ray ray)
    {
        //   ReleasedEvent.Invoke();

        // 2.b: Set IsScaling to be false.
        IsScaling = false; //RA DISABLED
    }
    private void GestureRecognizer_TappedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
    {
        if (focusedObject != null)
        {
            focusedObject.SendMessage("OnSelect");
#if WINDOWS_UWP
            if (dataRecorder)
            {
                dataRecorder.QueueMessage(focusedObject.name + ";OnSelect");
            }
#endif
            //sw.WriteLine(focusedObject.name + " OnSelect");
        }
        //UNCOMMENT THIS FOR GAZE MARKER
        else if (brainParts != null)
        {
            brainParts.SendMessage("OnEmptyTap");
#if WINDOWS_UWP
            if (dataRecorder)
            {
                dataRecorder.QueueMessage("BrainParts;OnEmptyTap");
            }
#endif
            //sw.WriteLine("BrainParts OnEmptyTap");
        }
    }
 private void Recognizer_TappedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
 {
     HandleStickyNoteTap();
     HandleDismissOnSelect();
     HandleBillboardDelete();
     HandleBillboardEdit();
 }
    void Tapped(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
    {
        RaycastHit hitInfo;

        if (Physics.Raycast(headRay, out hitInfo))
        {
            bool found = false;
            for (int i = 0; i < nestedColliders.Length; ++i)
            {
                if (hitInfo.collider == nestedColliders[i])
                {
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                return;
            }

            minimized = !minimized;

            max.SetActive(!minimized);
            min.SetActive(minimized);
        }
    }
Exemple #8
0
 private void SwitchAllowTrack(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Ray headRay)
 {
     if (enableHoldFunction)
     {
         allowTrack = !allowTrack;
         TrackingObject.SetActive(allowTrack);
     }
 }
        private void Recognizer_TappedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
        {
            var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);                                  // Create a cube

            cube.transform.localScale = Vector3.one * 0.3f;                                             // Make the cube smaller
            cube.transform.position   = Camera.main.transform.position + Camera.main.transform.forward; // Start to drop it in front of the camera
            cube.AddComponent <Rigidbody>();                                                            // Apply physics
        }
Exemple #10
0
    private void NavigationRecognizer_NavigationUpdatedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 relativePosition, Ray ray)
    {
        // 2.b: Set IsNavigating to be true.
        IsNavigating = true;

        // 2.b: Set NavigationPosition to be relativePosition.
        NavigationPosition = relativePosition;
    }
Exemple #11
0
    // ------------------------



    private void ScaleRecognizer_TappedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray ray)
    {
        GameObject focusedObject = InteractibleManager.Instance.FocusedGameObject;

        if (focusedObject != null)
        {
            focusedObject.SendMessageUpwards("OnSelect", SendMessageOptions.DontRequireReceiver);
        }
    }
        private void NavigationCompletedCallback(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 relativePosition, Ray ray)
        {
            AFocuser focuser = GetFocuserForSource(source);

            if (focuser != null)
            {
                NavigationCompletedEvent(focuser, relativePosition, ray);
            }
        }
Exemple #13
0
        //navigation event handlers
        //method to send an OnSelect message to the focused object when the user airtaps
        private void NavTapped(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray ray)
        {
            GameObject focusedObject = this.gameObject.GetComponent <GazeManager>().FocusedObject;

            if (focusedObject != null)
            {
                focusedObject.SendMessage("Selected");
            }
        }
        private void HoldCanceledCallback(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Ray ray)
        {
            AFocuser focuser = GetFocuserForSource(source);

            if (focuser != null)
            {
                HoldCanceledEvent(focuser, ray);
            }
        }
Exemple #15
0
        private void GestureHandler_NavigationUpdated(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 normalizedOffset, Ray headRay)
        {
            if (!m_Navigating)
            {
                return;
            }

            m_NavigationNormalizedOffset = normalizedOffset;
        }
Exemple #16
0
    private void ScaleRecognizer_ScaleUpdatedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 relativePosition, Ray ray)
    {
        // 2.b: Set IsScaling to be true.
        IsScaling = true;
        //   rotateRA = true;

        // 2.b: Set ScalePosition to be relativePosition.
        ScalePosition = relativePosition;
    }
        private void ManipulationCanceledCallback(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 position, Ray ray)
        {
            AFocuser focuser = GetFocuserForSource(source);

            if (focuser != null)
            {
                ManipulationCanceledEvent(focuser, position, ray);
            }
        }
Exemple #18
0
    // --------------------------------------------------------------------------------------

    // --------------------------------------------------------------------------------------



    private void ScaleRecognizer_ScaleStartedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 relativePosition, Ray ray)
    {
        ActiveEvent.Invoke();

        // 2.b: Set IsNavigating to be true.
        IsScaling = true;

        // 2.b: Set NavigationPosition to be relativePosition.
        ScalePosition = relativePosition;
    }
Exemple #19
0
    private void Recognizer_TappedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
    {
        var direction = headRay.direction;

        var origin = headRay.origin;

        var position = origin + direction * 2.0f;

        Instantiate(cubePrefab, position, Quaternion.identity);
    }
Exemple #20
0
 private void ManipulationRecognizer_ManipulationCanceledEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 position, Ray ray)
 {
     Debug.Log("Canceled");
     if (ManipulatingObject != null)
     {
         ManipulatingObject.SendMessageUpwards("PerformManipulationStop");
     }
     IsManipulating     = false;
     ManipulatingObject = null;
 }
Exemple #21
0
    private void ManipulationRecognizer_ManipulationUpdatedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 position, Ray ray)
    {
        if (HandsManager.Instance.FocusedGameObject != null)
        {
            IsManipulating = true;

            ManipulationPosition = position;

            HandsManager.Instance.FocusedGameObject.SendMessageUpwards("PerformManipulationUpdate", position);
        }
    }
Exemple #22
0
        private void ManUpdated(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 position, Ray ray)
        {
            GameObject focusedObject = this.gameObject.GetComponent <GazeManager>().FocusedObject;

            if (focusedObject != null)
            {
                IsManipulating       = true;
                ManipulationPosition = position;
                focusedObject.gameObject.SendMessage("ManipulationUpdate");
            }
        }
 void OnAirTap(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
 {
     if (SelectionManager.instance.HasSelection)
     {
         OnRightClick(headRay);
     }
     else
     {
         OnLeftClick(headRay);
     }
 }
Exemple #24
0
 private void ManipulationRecognizer_ManipulationStartedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 position, Ray ray)
 {
     if (FocusedObject != null && manipulatingEnabled)
     {
         Debug.Log("Started");
         manipulationStartingPosition = position;
         ManipulatingObject           = FocusedObject.gameObject;
         ManipulatingObject.SendMessageUpwards("PerformManipulationStart", position);
     }
     audiosource.PlayOneShot(ClickSound, 1);
 }
Exemple #25
0
    private void Recognizer_TappedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
    {
        RaycastHit hitInfo;

        if (!_characterExist && Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hitInfo, Mathf.Infinity))
        {
            GameObject character = Instantiate(_character, hitInfo.point, Quaternion.Euler(0, transform.eulerAngles.y + 180f, 0));
            _characterAnimator = _character.GetComponent <Animator>();
            _characterExist    = true;

            Camera.main.gameObject.GetComponent <UnityEngine.XR.WSA.SpatialMappingRenderer>().enabled = false;
        }
    }
Exemple #26
0
 void OnTap(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
 {
     if (!placementSelected)
     {
         placementSelected = true;
         placementPrompt.gameObject.SetActive(false);
         LoadContentScene();
     }
     else
     {
         stepController.SkipForward();
     }
 }
Exemple #27
0
 void NextItem(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
 {
     if (currentItem != -1)
     {
         transforms[currentItem].gameObject.SetActive(false);
     }
     currentItem++;
     if (currentItem >= transforms.Count)
     {
         currentItem = -1;
         return;
     }
     transforms[currentItem].gameObject.SetActive(true);
 }
Exemple #28
0
 private void GestureRecognizer_TappedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay)
 {
     if (tapCount == 2)
     {
         if (canvas.activeSelf == false)
         {
             canvas.SetActive(true);
         }
         else
         {
             canvas.SetActive(false);
         }
     }
 }
Exemple #29
0
 private void ManipulationRecognizer_ManipulationUpdatedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 position, Ray ray)
 {
     if (!IsManipulating)
     {
         if ((position - manipulationStartingPosition).magnitude > 0.05)
         {
             IsManipulating = true;
         }
     }
     if (IsManipulating && ManipulatingObject != null)
     {
         Debug.Log("Updated");
         ManipulatingObject.SendMessageUpwards("PerformManipulationUpdate", position);
     }
 }
Exemple #30
0
    // --------------------------------------------------------------------------------------

    // --------------------------------------------------------------------------------------



    private void ManipulationRecognizer_ManipulationStartedEvent(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 position, Ray ray)
    {
        if (HandsManager.Instance.FocusedGameObject != null)
        {
            ActiveEvent.Invoke();

            IsManipulating = true;

            ManipulationPosition = position;

            HandsManager.Instance.FocusedGameObject.SendMessageUpwards("PerformManipulationStart", position, SendMessageOptions.DontRequireReceiver);

            //  print("moving by finger"); // RA
        }
    }