https://github.com/quantumplation/bevy-hex-example
https://github.com/quantumplation/bevy-hex-example
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/quantumplation/bevy-hex-example
- Owner: Quantumplation
- Created: 2020-12-30T03:30:38.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-23T18:59:15.000Z (over 2 years ago)
- Last Synced: 2024-12-26T23:49:21.129Z (over 1 year ago)
- Language: Rust
- Size: 2.07 MB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bevy 3D Hex Example
I put together a small 3D hex grid for a game I was working on, and there was some interest in how I achieved that. I extracted that code into this repository for people to learn from.
It was heavily inspired by two main resources:
- [Redblobgames' excellent writeup on hex grids](https://www.redblobgames.com/grids/hexagons/#map-storage)
- [Catlike Coding's tutorial series on hex grids in unity](https://catlikecoding.com/unity/tutorials/hex-map/)
## Screen recording
[bevy-hex-example.webm](https://github.com/kolbma/bevy-hex-example/assets/5228369/98a46f67-465f-4508-ad0a-4570eab237fe)
## Outline
I recommend perusing the source in this order:
- hex.rs: Simple hex-coordinate operations, such as neighbors and the like
- geometry.rs: Generates 3D points for a simple hex mesh
- main.rs: Wires this together to set up a bevy scene
## Future
I don't have a lot of free time, so I didn't wrap this up in a bevy plugin for use by the community. If there's substantial interest, however, I might be talked into that.