| Crates.io | bevy_mod_spatial_query |
| lib.rs | bevy_mod_spatial_query |
| version | 0.2.0 |
| created_at | 2025-03-26 23:46:54.812512+00 |
| updated_at | 2025-03-27 21:56:30.35452+00 |
| description | Spatially aware Queries for the Bevy game engine |
| homepage | https://github.com/Feilkin/bevy_mod_spatial_query |
| repository | https://github.com/Feilkin/bevy_mod_spatial_query |
| max_upload_size | |
| id | 1607323 |
| size | 147,922 |
Spatially aware queries for the Bevy game engine
SpatialQuery<Data, Filters>, just like vanilla Query!SpatialLookupAlgorithm trait!cargo add bevy_mod_spatial_query
use bevy::prelude::*;
use bevy_mod_spatial_query::*;
fn main() {
let mut app = App::new();
app.add_plugins(DefaultPlugins)
.add_plugins(SpatialQueryPlugin)
.add_systems(Update, your_awesome_system);
app.run();
}
#[derive(Component)]
struct Player;
fn your_awesome_system(
player: Single<&Transform, With<Player>>,
nearby_lights: SpatialQuery<&mut PointLight>
) {
for light in nearby_lights.in_radius(player.translation, 10.) {
// Do something with the lights...
}
}
Found a problem or have a suggestion? Feel free to open an issue.
bevy_mod_spatial_query is licensed under the MIT license.