From 9e45aef7e4af10299f6f75ac6f081ed013970836 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sat, 18 Feb 2023 19:46:18 -0800 Subject: [PATCH 1/3] checkpoint --- src/bike/body.rs | 2 +- src/bike/components.rs | 4 +--- src/main.rs | 5 ++++- src/planet.rs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bike/body.rs b/src/bike/body.rs index 4216915..29ea08c 100644 --- a/src/bike/body.rs +++ b/src/bike/body.rs @@ -16,7 +16,7 @@ pub(super) fn spawn_cyberbike( wheel_conf: Res, mut meshterials: Meshterial, ) { - let altitude = PLANET_RADIUS - 100.0; + let altitude = PLANET_RADIUS + 10.0; let mut xform = Transform::from_translation(Vec3::X * altitude) .with_rotation(Quat::from_axis_angle(Vec3::Z, -89.0f32.to_radians())); diff --git a/src/bike/components.rs b/src/bike/components.rs index 674f902..2514878 100644 --- a/src/bike/components.rs +++ b/src/bike/components.rs @@ -16,7 +16,6 @@ pub struct CyberWheel; #[reflect(Resource)] pub struct WheelConfig { pub front_forward: f32, - pub front_stance: f32, pub rear_back: f32, pub y: f32, pub limits: [f32; 2], @@ -30,8 +29,7 @@ pub struct WheelConfig { impl Default for WheelConfig { fn default() -> Self { Self { - front_forward: 0.9, - front_stance: 0.65, + front_forward: 0.8, rear_back: 1.1, y: -0.1, limits: [-0.7, 0.1], diff --git a/src/main.rs b/src/main.rs index 4c203ab..3fc070e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,10 +5,13 @@ use cyber_rider::{ planet::CyberPlanetPlugin, ui::CyberUIPlugin, }; +// const CYBER_SKY: Color = Color::rgb(0.07, 0.001, 0.02); +const CYBER_SKY: Color = Color::rgb(0.64, 0.745, 0.937); + fn main() { let mut app = App::new(); app.insert_resource(Msaa { samples: 4 }) - .insert_resource(ClearColor(Color::rgb(0.07, 0.001, 0.02))) + .insert_resource(ClearColor(CYBER_SKY)) .add_plugins(DefaultPlugins.set(WindowPlugin { window: WindowDescriptor { width: 2560.0, diff --git a/src/planet.rs b/src/planet.rs index eb19646..5b4a5ea 100644 --- a/src/planet.rs +++ b/src/planet.rs @@ -87,7 +87,7 @@ fn gen_planet(sphere: Icosphere) -> (Mesh, Collider) { .iter() .map(|&p| { let disp = noise.get(p.as_dvec3().into()) as f32 * 0.04; - let pt = p + (p.normalize() * disp); + let pt = p; // + (p.normalize() * disp); pt.into() }) .collect::>(); From 3d2d413946fae277aaf9b4ee7f0d526e7f7e22e1 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sat, 18 Feb 2023 20:35:05 -0800 Subject: [PATCH 2/3] add 0.1 meters of trail to front wheel. --- src/bike/wheels.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bike/wheels.rs b/src/bike/wheels.rs index 6a6dd1b..fc06c4b 100644 --- a/src/bike/wheels.rs +++ b/src/bike/wheels.rs @@ -96,7 +96,8 @@ pub fn spawn_tires( .id(); let axel_parent_entity = if let Some(steering) = steering { - let neck_builder = RevoluteJointBuilder::new(Vec3::Y); + let neck_builder = + RevoluteJointBuilder::new(Vec3::Y).local_anchor1(Vec3::new(0.0, 0.0, 0.1)); let neck_joint = MultibodyJoint::new(fork_rb_entity, neck_builder); let neck = commands .spawn(RigidBody::Dynamic) From 757ce02df2f29b3a95395e9d86bc663732b3a82e Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Sat, 18 Feb 2023 21:57:06 -0800 Subject: [PATCH 3/3] add density to wheelconf --- src/bike/components.rs | 2 ++ src/bike/wheels.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bike/components.rs b/src/bike/components.rs index 2514878..a7918ff 100644 --- a/src/bike/components.rs +++ b/src/bike/components.rs @@ -24,6 +24,7 @@ pub struct WheelConfig { pub radius: f32, pub friction: f32, pub restitution: f32, + pub density: f32, } impl Default for WheelConfig { @@ -38,6 +39,7 @@ impl Default for WheelConfig { radius: 0.3, friction: 0.9, restitution: 0.8, + density: 0.9, } } } diff --git a/src/bike/wheels.rs b/src/bike/wheels.rs index fc06c4b..3bf9949 100644 --- a/src/bike/wheels.rs +++ b/src/bike/wheels.rs @@ -75,7 +75,7 @@ pub fn spawn_tires( ..Default::default() }; let wheel_collider = Collider::ball(wheel_rad); - let mass_props = ColliderMassProperties::Density(0.1); + let mass_props = ColliderMassProperties::Density(conf.density); let damping = conf.damping; let prismatic_axis = if steering.is_some() {