2 unstable releases
Uses new Rust 2024
new 0.2.0 | Mar 27, 2025 |
---|---|
0.1.0 | Mar 26, 2025 |
#457 in Game dev
123 downloads per month
39KB
376 lines
bevy_mod_spatial_query
Spatially aware queries for the Bevy game engine
Features
- Fast spatial lookup for queries
- Ergonomic interface:
SpatialQuery<Data, Filters>
, just like vanillaQuery
! - Extendable: You can implement your own spatial lookup algorithms by implementing the
SpatialLookupAlgorithm
trait!
Installation
cargo add bevy_mod_spatial_query
Usage
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...
}
}
Contribution
Found a problem or have a suggestion? Feel free to open an issue.
License
bevy_mod_spatial_query
is licensed under the MIT license.
Dependencies
~31–64MB
~1M SLoC