bevy_sparse_grid_2d
An opinionated 2D sparse grid made for use with Bevy. For storing and querying entities.
Personally, I'm using it for simple stupid collision broad phase in a couple of my projects.
Usage
use ;
use SparseGrid2d;
const TILE_SIZE: usize = 1; // how wide each cell is
let mut db = default;
let e1 = from_raw_u32.unwrap;
let e2 = from_raw_u32.unwrap;
db.insert_point;
db.insert_point;
// query a single point
let matches: = db.point_iter.collect;
assert!;
assert!;
assert_eq!;
// query an aabb
let aabb = new;
let matches = db.query_aabb;
assert!;
assert!;
assert_eq!;
See tests in lib.rs
Bevy Version Support
The main branch targets the latest bevy release.
| bevy | bevy_sparse_grid_2d |
|---|---|
| 0.17 | 0.8, main |
| 0.16 | 0.7 |
| 0.15 | 0.6 |
| 0.14 | 0.5 |
| 0.13 | 0.4 |
| 0.12 | 0.3 |
| 0.11 | 0.2 |
| 0.10 | 0.1 |
License
MIT or Apache-2.0
Contributions
PRs welcome!