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(); } } }
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); } }
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 }
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); } }
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 }
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; }
// ------------------------ 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); } }
//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); } }
private void GestureHandler_NavigationUpdated(UnityEngine.XR.WSA.Input.InteractionSourceKind source, Vector3 normalizedOffset, Ray headRay) { if (!m_Navigating) { return; } m_NavigationNormalizedOffset = normalizedOffset; }
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); } }
// -------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------- 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; }
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); }
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; }
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); } }
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); } }
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); }
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; } }
void OnTap(UnityEngine.XR.WSA.Input.InteractionSourceKind source, int tapCount, Ray headRay) { if (!placementSelected) { placementSelected = true; placementPrompt.gameObject.SetActive(false); LoadContentScene(); } else { stepController.SkipForward(); } }
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); }
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); } } }
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); } }
// -------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------- 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 } }