Following others' gaze direction is an important source of information that helps to detect prey or predators, to notice important social events within one's social group and to predict the next actions of others. As such, it is considered a key step towards an understanding of mental states, such as attention and intention.
Many animals will follow the gaze of others into distant space. Following a gaze around a barrier, which is considered to be a more cognitively advanced task, is much less common.