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
        private Vector3 CurrentProjectedPlanePoint(out bool _flagHit)
        {
            Ray cameraMouseRay = UnityUtilities.GenerateSelectionRay();            //Camera.main.ScreenPointToRay(Input.mousePosition);

            // NB! Isn't it the same as mouse Ray
            if (this.activeMovable.orientationPlane.Raycast(cameraMouseRay, out float rayDistance))
            {
                _flagHit = true;
                return(cameraMouseRay.GetPoint(rayDistance));
            }
            _flagHit = false;
            return(Vector3.zero);
        }