//This creates the ray
        public void CastRay(Ray ray, int currentVisualizationId)
        {
            //Debug.DrawLine(_ray.origin, _ray.direction * maxDistance, Color.red);
            //Debug.Log(ray.direction.ToString() + " " + currentVisualizationId.ToString());
            if (Physics.Raycast(ray, out _raycastHit, maxDistance, ignoredLayerMask))
            {
                //Debug.Log ("Entre al if del raycast del mouse");
                var posiblePitcheGrabObject = _raycastHit.transform.gameObject.GetComponent <PitchGrabObject>();

                if (posiblePitcheGrabObject == null)
                {
                    return;
                }

                if (posiblePitcheGrabObject.dioController.visualizationController.id != currentVisualizationId)
                {
                    if (_actualPitchGrabObject != null)
                    {
                        _actualPitchGrabObject.OnUnDetect();    //funcion para ignorar las imagenes que se encuentren en otras vistas
                    }

                    return;
                }


                if (_actualPitchGrabObject == null)
                {
                    _actualPitchGrabObject = posiblePitcheGrabObject;   //en una primera instancia actualPitch es null, la primera vez que toca una foto valida toma el valor de posiblePitch
                    RegisterRay(_actualPitchGrabObject);
                }
                else
                {
                    if (_actualPitchGrabObject.idName != posiblePitcheGrabObject.idName) //si actualPitch no coincide con posiblePitch se actualiza actualPitch
                    {
                        _actualPitchGrabObject.OnUnDetect();                             // actualPitch se hace null
                        _actualPitchGrabObject = posiblePitcheGrabObject;                //se le asigna el valor de posiblePitch
                        RegisterRay(_actualPitchGrabObject);
                    }
                }
                _actualPitchGrabObject.OnDetected();        //activa el MARCAR de buttonPanel y activa LookPointerStay que aplica ZoomIn(iluminar foto)
            }
            else
            {
                if (_actualPitchGrabObject == null)
                {
                    //DELETE THIS tie button panel
                    //_dioManager.buttonPanel.DisableZoomIn();
                    return;
                }

                _actualPitchGrabObject.OnUnDetect();        //si actualPitch no era nulo se hace null
            }
        }
        public void Update()
        {
            if (!_dioManager.mouseInput)
            {
                _forwardVector = transform.TransformDirection(Vector3.forward);
                _ray           = new Ray(transform.position, _forwardVector);
            }
            else
            {
                _ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            }

            if (Physics.Raycast(_ray, out _raycastHit, maxDistance, ignoredLayerMask))
            {
                var posiblePitcheGrabObject = _raycastHit.transform.gameObject.GetComponent <PitchGrabObject>();

                if (posiblePitcheGrabObject == null)
                {
                    return;
                }

                if (posiblePitcheGrabObject.dioController.visualizationController.id != _dioManager.actualVisualization)
                {
                    if (_actualPitchGrabObject != null)
                    {
                        _actualPitchGrabObject.OnUnDetect();
                    }

                    return;
                }

                if (_actualPitchGrabObject == null)
                {
                    _actualPitchGrabObject = posiblePitcheGrabObject;
                }
                else
                {
                    if (_actualPitchGrabObject.idName != posiblePitcheGrabObject.idName)
                    {
                        _actualPitchGrabObject.OnUnDetect();
                        _actualPitchGrabObject = posiblePitcheGrabObject;
                    }
                }

                DebugLog(posiblePitcheGrabObject);

                _actualPitchGrabObject.OnDetected();
            }
            else
            {
                if (_actualPitchGrabObject == null)
                {
                    _dioManager.buttonPanel.DisableZoomIn();
                    return;
                }

                _actualPitchGrabObject.OnUnDetect();
            }
        }