Hexx
Hexagonal tools lib in rust.
Inspired by this
RedBlobGames
article.
This lib allows you to:
- Manipulate hexagon coordinates
- Generate hexagonal maps with custom layouts and orientation
- Generate hexagon meshes (planes or columns)
I made the choice to use Axial Coordinates for performance and utility reasons,
but the [Hex
] type has conversion utilities with cubic, doubled and offset coordinates.
See the hexagonal coordinate systems
Features
hexx
provides the [Hex
] coordinates with:
- Distances
- Neighbors and directions
- Lines
- Ranges
- Rings
- Spirals
- Rotation
- Symmetry
- Vector operations
- Conversions to other coordinate systems
And the [HexMap
] utility, for wraparound (seamless) hexagonal maps
Usage in bevy
If you want to generate 3D hexagonal mesh and use it in bevy you may do it this way:
use Mesh;
use ;
use ;
The [MeshInfo
] type provides the following mesh generations:
- [
MeshInfo::hexagonal_plane
] (7 vertices) useful for 2D games - [
MeshInfo::cheap_hexagonal_column
] (13 vertices) with merged vertices and useful only for unlit games - [
MeshInfo::partial_hexagonal_column
] (31 vertices) without the bottom face - [
MeshInfo::hexagonal_column
] (38 vertices) with the bottom face
See the examples for bevy usage
Example
cargo run --example hex_grid
cargo run --example 3d_columns