Animals can maintain a stable sense of direction even when they navigate in novel environments, but how the animal's brain interprets and encodes unfamiliar sensory information in its navigation system to maintain a stable sense of direction is a mystery. Recent studies have suggested that distinct brain structures of mammals and insects have evolved to solve this common problem with strategies that share computational principles; specifically, a network structure called a ring attractor maintains the sense of direction. Initially, in a novel environment, the animal's sense of direction relies on self-motion cues. Over time, the mapping from visual inputs to head direction cells, responsible for the sense of direction, is established via experience-dependent plasticity. Yet the mechanisms that facilitate acquiring a world-centered sense of direction, how many environments can be stored in memory, and what visual features are selected, all remain unknown. Thanks to recent advances in large scale physiological recording, genetic tools, and theory, these mechanisms may soon be revealed.