bevy_mod_spatial_query

Crates.iobevy_mod_spatial_query
lib.rsbevy_mod_spatial_query
version0.2.0
created_at2025-03-26 23:46:54.812512+00
updated_at2025-03-27 21:56:30.35452+00
descriptionSpatially aware Queries for the Bevy game engine
homepagehttps://github.com/Feilkin/bevy_mod_spatial_query
repositoryhttps://github.com/Feilkin/bevy_mod_spatial_query
max_upload_size
id1607323
size147,922
Ada Hieta (Feilkin)

documentation

README

bevy_mod_spatial_query

Build Status Crates.io Version docs.rs Static Badge

Spatially aware queries for the Bevy game engine

Features

  • Fast spatial lookup for queries
  • Ergonomic interface: SpatialQuery<Data, Filters>, just like vanilla Query!
  • 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.

Commit count: 42

cargo fmt