From 374ea20d5b5e4290e84da63e2608b1784f8d1f63 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 29 Dec 2020 16:53:48 +0100 Subject: [PATCH] better movement, floor and exit with escape --- src/camera.rs | 4 ++-- src/main.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index dcd308b..ce23e2c 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -18,7 +18,7 @@ impl Default for FlyCamera { fn default() -> Self { Self { speed: 1.5, - sensitivity: 3.0, + sensitivity: 6.0, friction: 1.0, pitch: 0.0, yaw: 0.0, @@ -76,7 +76,7 @@ fn camera_movement_system( let rotation = transform.rotation; let accel: Vec3 = (strafe_vector(&rotation) * axis_h) - + (forward_walk_vector(&rotation) * axis_v) + + (forward_vector(&rotation) * axis_v) + (Vec3::unit_y() * axis_float); let accel: Vec3 = if accel.length() != 0.0 { accel.normalize() * options.speed diff --git a/src/main.rs b/src/main.rs index ee4e4b4..0f6cc76 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,6 +44,14 @@ fn init( } } } + + // create a floor + commands.spawn(PbrBundle { + mesh: meshes.add(Mesh::from(shape::Plane { size: 10. })), + material: materials.add(Color::rgb(0.5, 0.9, 0.9).into()), + transform: Transform::from_translation(Vec3::new(0.0, -3.0, 0.0)), + ..Default::default() + }); } fn exit_game_system(keyboard_input: Res>) {