From 3f89826acb2f03e6f8df91319fc6dd5ca7025d6a Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 1 Apr 2024 21:07:28 +0200 Subject: [PATCH] tweak asteroid parameters --- src/world.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/world.rs b/src/world.rs index 9e9e203..869ab80 100644 --- a/src/world.rs +++ b/src/world.rs @@ -166,16 +166,17 @@ pub fn setup( fn generate_asteroids( mut db: ResMut, ) { - let maxdist = 4; + let maxdist = 30; + let maxdist_orthogonal = maxdist / 4; let pi = PI as f64; let player_x: f64 = -300000.0; let player_y: f64 = 0.0; let player_z: f64 = -500000.0; + let offset: f64 = 500.0; + let dist: f64 = 8e3; for i in -maxdist..maxdist { - for j in -maxdist..maxdist { + for j in -maxdist_orthogonal..maxdist_orthogonal { for k in -maxdist..maxdist { - let offset: f64 = 500.0; - let dist: f64 = 8e3; let wobble: f64 = dist/2.0; let (i, j, k) = (i as f64, j as f64, k as f64); db.0.push(AsteroidData { @@ -216,7 +217,7 @@ fn spawn_despawn_asteroids( let mut despawned = 0; for asteroid in &mut db.0 { let dist = player.distance(asteroid.pos); - let should_spawn = dist < 10000.0; + let should_spawn = dist < 50000.0; if should_spawn == asteroid.is_spawned { continue; // Nothing to do } @@ -249,7 +250,7 @@ fn spawn_despawn_asteroids( Asteroid, )); if ASTEROIDS_ARE_SPHERES { - let sphere_handle = meshes.add(Sphere::default().mesh().uv(128, 128)); + let sphere_handle = meshes.add(Sphere::default()); let sphere_material_handle = materials.add(StandardMaterial { base_color: Color::rgb(0.4, 0.4, 0.4), perceptual_roughness: 1.0,