tweak asteroid parameters

This commit is contained in:
yuni 2024-04-01 21:07:28 +02:00
parent bbad89e1fb
commit 3f89826acb

View file

@ -166,16 +166,17 @@ pub fn setup(
fn generate_asteroids(
mut db: ResMut<AsteroidDatabase>,
) {
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;
for i in -maxdist..maxdist {
for j in -maxdist..maxdist {
for k in -maxdist..maxdist {
let offset: f64 = 500.0;
let dist: f64 = 8e3;
for i in -maxdist..maxdist {
for j in -maxdist_orthogonal..maxdist_orthogonal {
for k in -maxdist..maxdist {
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,