{"id":15023219,"url":"https://github.com/johanhelsing/bevy_sparse_grid_2d","last_synced_at":"2025-10-26T16:30:59.107Z","repository":{"id":77177908,"uuid":"597361332","full_name":"johanhelsing/bevy_sparse_grid_2d","owner":"johanhelsing","description":"An opinionated 2D sparse grid made for use with Bevy. For storing and querying entities","archived":false,"fork":false,"pushed_at":"2024-11-30T11:14:35.000Z","size":33,"stargazers_count":14,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-31T21:34:24.557Z","etag":null,"topics":["2d","bevy","gamedev","physics","rust","spatial-hash"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johanhelsing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-04T10:02:16.000Z","updated_at":"2025-01-13T14:35:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"f14b2e7e-807c-4d22-ad56-a4579af64e8c","html_url":"https://github.com/johanhelsing/bevy_sparse_grid_2d","commit_stats":{"total_commits":28,"total_committers":3,"mean_commits":9.333333333333334,"dds":0.1071428571428571,"last_synced_commit":"7eed90e4cdb9e0bdb88967da1449037ff7279710"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanhelsing%2Fbevy_sparse_grid_2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanhelsing%2Fbevy_sparse_grid_2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanhelsing%2Fbevy_sparse_grid_2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanhelsing%2Fbevy_sparse_grid_2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johanhelsing","download_url":"https://codeload.github.com/johanhelsing/bevy_sparse_grid_2d/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238366812,"owners_count":19460190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d","bevy","gamedev","physics","rust","spatial-hash"],"created_at":"2024-09-24T19:58:50.925Z","updated_at":"2025-10-26T16:30:59.102Z","avatar_url":"https://github.com/johanhelsing.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bevy_sparse_grid_2d\n\n[![crates.io](https://img.shields.io/crates/v/bevy_sparse_grid_2d.svg)](https://crates.io/crates/bevy_sparse_grid_2d)\n![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)\n\nAn opinionated 2D sparse grid made for use with Bevy. For storing and querying entities.\n\nPersonally, I'm using it for simple stupid collision broad phase in a couple of my projects.\n\n## Usage\n\n```rust\nuse bevy::{\n    math::{bounding::Aabb2d, vec2},\n    prelude::*,\n    platform::collections::HashSet\n};\nuse bevy_sparse_grid_2d::SparseGrid2d;\nconst TILE_SIZE: usize = 1; // how wide each cell is\n\nlet mut db = SparseGrid2d::\u003cTILE_SIZE\u003e::default();\nlet e1 = Entity::from_raw_u32(1).unwrap();\nlet e2 = Entity::from_raw_u32(2).unwrap();\ndb.insert_point(vec2(0.5, 0.5), e1);\ndb.insert_point(vec2(0.499, 0.501), e2);\n\n// query a single point\nlet matches: HashSet\u003c_\u003e = db.point_iter(vec2(0.499, 0.501)).collect();\nassert!(matches.contains(\u0026e1));\nassert!(matches.contains(\u0026e2));\nassert_eq!(matches.len(), 2);\n\n// query an aabb\nlet aabb = Aabb2d::new(Vec2::new(0.001, 0.001), Vec2::new(0.001, 0.001));\nlet matches = db.query_aabb(aabb);\nassert!(matches.contains(\u0026e1));\nassert!(matches.contains(\u0026e2));\nassert_eq!(matches.len(), 2);\n```\n\nSee tests in lib.rs\n\n## Bevy Version Support\n\nThe `main` branch targets the latest bevy release.\n\n|bevy|bevy_sparse_grid_2d|\n|----|-------------------|\n|0.17|0.8, main          |\n|0.16|0.7                |\n|0.15|0.6                |\n|0.14|0.5                |\n|0.13|0.4                |\n|0.12|0.3                |\n|0.11|0.2                |\n|0.10|0.1                |\n\n## License\n\nMIT or Apache-2.0\n\n## Contributions\n\nPRs welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanhelsing%2Fbevy_sparse_grid_2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohanhelsing%2Fbevy_sparse_grid_2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanhelsing%2Fbevy_sparse_grid_2d/lists"}