diff --git a/assets/settings/camera.ron b/assets/settings/camera.ron index 5610f91..fe77b02 100644 --- a/assets/settings/camera.ron +++ b/assets/settings/camera.ron @@ -6,4 +6,4 @@ yaw_speed: 0.004, pan_speed: 0.01, pan_zoom_mult: 0.1, -) +) \ No newline at end of file diff --git a/assets/settings/input_map.ron b/assets/settings/input_map.ron index 635e99b..4c7789e 100644 --- a/assets/settings/input_map.ron +++ b/assets/settings/input_map.ron @@ -16,11 +16,11 @@ MouseButton(Middle): [ CameraOrbitEnable, ], - KeyCode(Escape): [ - TogglePause, - ], MouseButton(Left): [ CameraPanEnable, ], + KeyCode(Escape): [ + TogglePause, + ], }, ) \ No newline at end of file diff --git a/crates/level/src/lib.rs b/crates/level/src/lib.rs index 450e9ed..62312b0 100644 --- a/crates/level/src/lib.rs +++ b/crates/level/src/lib.rs @@ -40,19 +40,27 @@ fn setup( // Dynamic physics object with a collision shape and initial angular velocity for y in 5..15 { - commands.spawn(( - RigidBody::Dynamic, - Collider::cuboid(1.0, 1.0, 1.0), - AngularVelocity(Vec3::new(2.5, 3.5, 1.5)), - Mesh3d(meshes.add(Cuboid::from_length(1.0))), - MeshMaterial3d(materials.add(StandardMaterial { - base_color: Color::srgb_u8(220, 156, 86), - metallic: 1.0, - perceptual_roughness: 0.3, - ..default() - })), - Transform::from_xyz(0.0, y as f32 * 1.1, 0.0), - )); + commands + .spawn(( + RigidBody::Dynamic, + Collider::cuboid(1.0, 1.0, 1.0), + AngularVelocity(Vec3::new(2.5, 3.5, 1.5)), + Mesh3d(meshes.add(Cuboid::from_length(1.0))), + MeshMaterial3d(materials.add(StandardMaterial { + base_color: Color::srgb_u8(220, 156, 86), + metallic: 1.0, + perceptual_roughness: 0.3, + ..default() + })), + Transform::from_xyz(0.0, y as f32 * 1.1, 0.0), + )) + .observe( + |trigger: Trigger>, mut query: Query<&mut LinearVelocity>| { + if let Ok(mut v) = query.get_mut(trigger.target()) { + v.y += 3.0; + } + }, + ); } // Light diff --git a/crates/physics/src/lib.rs b/crates/physics/src/lib.rs index b5fdb79..6f0020d 100644 --- a/crates/physics/src/lib.rs +++ b/crates/physics/src/lib.rs @@ -9,6 +9,6 @@ pub struct PhysicsPlugin; impl Plugin for PhysicsPlugin { fn build(&self, app: &mut App) { - app.add_plugins(PhysicsPlugins::default()); + app.add_plugins((PhysicsPlugins::default(), PhysicsPickingPlugin)); } }