//! Shows how to iterate over combinations of query results. use bevy::prelude::*; use rand::{rngs::StdRng, Rng, SeedableRng}; fn main() { App::new() .add_plugins(DefaultPlugins) .insert_resource(ClearColor(Color::BLACK)) .add_systems(Startup, generate_bodies) .add_systems(FixedUpdate, (interact_bodies, integrate)) .add_systems(Update, look_at_star) .run(); } const GRAVITY_CONSTANT: f32 = 0.001; const NUM_BODIES: usize = 100; #[derive(Component, Default)] struct Mass(f32); #[derive(Component, Default)] struct Acceleration(Vec3); #[derive(Component, Default)] struct LastPos(Vec3); #[derive(Component)] struct Star; #[derive(Bundle, Default)] struct BodyBundle { pbr: PbrBundle, mass: Mass, last_pos: LastPos, acceleration: Acceleration, } fn generate_bodies( time: Res