RaycastHit hit;
Ray ray = new Ray(transform.position, (camera.position - transform.position).normalized);
if (Physics.Raycast(ray, out hit))
{
camera.position = hit.point;
}
Debug.DrawRay(ray.origin, (camera.position - transform.position).normalized, Color.red);