Ejemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////
        private void CheckSelection()
        {
            // Send a ray and find if anything is being selected.
            Ray ray = UnityUtilities.GenerateCameraRay();

            if (Physics.Raycast(ray.origin, ray.direction, out this.hitGaze))
            {
                                #if DEBUG2
                Debug.Log("Interaction Manager: Gaze hit gameObject: " + this.hit.transform.gameObject.name);
                                #endif
                this.flagHitGaze = true;
            }
            else
            {
                this.flagHitGaze = false;                 // If nothing hit - reset history.
            }
            ray = UnityUtilities.GenerateSelectionRay();
            if (Physics.Raycast(ray.origin, ray.direction, out this.hitSelect))
            {
                                #if DEBUG2
                Debug.Log("Interaction Manager: Selection hit gameObject: " + this.hit.transform.gameObject.name);
                                #endif
                this.flagHitSelect = true;
            }
            else
            {
                this.flagHitSelect = false;                 // If nothing hit - reset history.
            }
        }
Ejemplo n.º 2
0
 public static Ray GenerateSelectionRay()
 {
                 #if WINDOWS_UWP
     return(UnityUtilities.GenerateCameraRay());
                 #else
     // If a mouse present - generate mouse ray, else - camera ray.
     if (Input.touchCount > 0)
     {
         return(UnityUtilities.GenerateTouchRay());
     }
     else             //if (Input.GetMouseButton(0)) // Special case for editor - use mouse but only if pressed
     {
         return(UnityUtilities.GenerateMouseRay());
     }
     //else
     //	return UnityUtilities.GenerateCameraRay();
                 #endif
 }