From 3e5e51401a31fa99317869041ee5f3a0a43e2bb2 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Tue, 9 May 2023 13:34:54 -0700 Subject: [PATCH] misc conf changes and stuffs --- src/action/components.rs | 2 +- src/bike/components.rs | 2 +- src/planet.rs | 20 +++++--------------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/action/components.rs b/src/action/components.rs index efa3cea..7a6587b 100644 --- a/src/action/components.rs +++ b/src/action/components.rs @@ -52,7 +52,7 @@ impl Default for MovementSettings { fn default() -> Self { Self { accel: 20.0, - gravity: 9.8, + gravity: 4.8, } } } diff --git a/src/bike/components.rs b/src/bike/components.rs index 7d28655..bd7f44f 100644 --- a/src/bike/components.rs +++ b/src/bike/components.rs @@ -35,7 +35,7 @@ impl Default for WheelConfig { rear_back: 1.0, y: -0.1, limits: [-0.5, 0.1], - stiffness: 150.0, + stiffness: 190.0, damping: 8.0, radius: 0.25, thickness: 0.11, diff --git a/src/planet.rs b/src/planet.rs index 4a36dd1..3d1f24d 100644 --- a/src/planet.rs +++ b/src/planet.rs @@ -12,7 +12,7 @@ use wgpu::PrimitiveTopology; use crate::Label; -pub const PLANET_RADIUS: f32 = 3_000.0; +pub const PLANET_RADIUS: f32 = 4_000.0; pub const PLANET_HUE: f32 = 31.0; pub const PLANET_SATURATION: f32 = 1.0; @@ -86,7 +86,7 @@ fn gen_planet(sphere: Icosphere) -> (Mesh, Collider) { .raw_points() .iter() .map(|&p| { - let disp = noise.get(p.as_dvec3().into()) as f32 * 0.05; + let disp = (noise.get(p.as_dvec3().into()) * 0.03f64) as f32; let pt = p + (p.normalize() * disp); pt.into() }) @@ -104,13 +104,7 @@ fn gen_planet(sphere: Icosphere) -> (Mesh, Collider) { max = v.max(max); } - let uvs = generated.raw_data().to_owned(); - - let mut indices = Vec::with_capacity(generated.indices_per_main_triangle() * 20); - - for i in 0..20 { - generated.get_indices(i, &mut indices); - } + let indices = generated.get_all_indices(); let mut idxs = Vec::new(); for idx in indices.chunks_exact(3) { @@ -118,9 +112,7 @@ fn gen_planet(sphere: Icosphere) -> (Mesh, Collider) { } let indices = Indices::U32(indices); - let shape = Collider::trimesh(points.iter().map(|p| Vect::from_slice(p)).collect(), idxs); - - dbg!(&points.len()); + let collider = Collider::trimesh(points.iter().map(|p| Vect::from_slice(p)).collect(), idxs); let mut mesh = Mesh::new(PrimitiveTopology::TriangleList); mesh.set_indices(Some(indices)); @@ -135,8 +127,6 @@ fn gen_planet(sphere: Icosphere) -> (Mesh, Collider) { .as_float3() .unwrap(); - dbg!(&tri_list.len()); - let mut rng = rand::rngs::StdRng::seed_from_u64(57); let mut colors = Vec::new(); for triangle in tri_list.chunks_exact(3) { @@ -159,7 +149,7 @@ fn gen_planet(sphere: Icosphere) -> (Mesh, Collider) { dbg!(&colors.len()); mesh.insert_attribute(Mesh::ATTRIBUTE_COLOR, colors); - (mesh, shape) + (mesh, collider) } /// remaps v in low..high to 0..1