Expand description
A navigation framework for moving between focusable elements based on directional input.
While virtual cursors are a common way to navigate UIs with a gamepad (or arrow keys!), they are generally both slow and frustrating to use. Instead, directional inputs should provide a direct way to snap between focusable elements.
Like the rest of this crate, the InputFocus
resource is manipulated to track
the current focus.
Navigating between focusable entities (commonly UI nodes) is done by
passing a CompassOctant
into the navigate
method
from the DirectionalNavigation
system parameter.
Under the hood, the DirectionalNavigationMap
stores a directed graph of focusable entities.
Each entity can have up to 8 neighbors, one for each CompassOctant
, balancing flexibility and required precision.
For now, this graph must be built manually, but in the future, it could be generated automatically.
Structs§
- Directional
Navigation - A system parameter for navigating between focusable entities in a directional way.
- Directional
Navigation Map - A resource that stores the traversable graph of focusable entities.
- Directional
Navigation Plugin - A plugin that sets up the directional navigation systems and resources.
- NavNeighbors
- The up-to-eight neighbors of a focusable entity, one for each
CompassOctant
.
Enums§
- Directional
Navigation Error - An error that can occur when navigating between focusable entities using directional navigation.