]> git.lizzy.rs Git - mt_client.git/commitdiff
Fix yaw
authorLizzy Fleckenstein <eliasfleckenstein@web.de>
Mon, 8 May 2023 20:39:21 +0000 (22:39 +0200)
committerLizzy Fleckenstein <eliasfleckenstein@web.de>
Mon, 8 May 2023 20:39:21 +0000 (22:39 +0200)
.gitignore
Cargo.lock
src/gfx.rs
src/gfx/state.rs

index bf051319198d8b64cc665917d57f4b2062132807..5a648b03d20caf69e7e8f5574f9a5517d04c99b3 100644 (file)
@@ -1,5 +1,5 @@
 /target
 config.yml
-/flamegraph.svg
-/perf.data
-/perf.data.old
+flamegraph.svg
+perf.data
+perf.data.old
index 73e08c80118de63446ced15a13656a2b91c3f025..4914157c8b50249b92b18460121f71d3767da1a4 100644 (file)
@@ -1082,7 +1082,7 @@ dependencies = [
 [[package]]
 name = "mt_net"
 version = "0.1.0"
-source = "git+https://github.com/minetest-rust/mt_net#2bf4f75254ddfca9ef13c6a1b2a8e6210f298ab5"
+source = "git+https://github.com/minetest-rust/mt_net#ea1983ec93aa6db9dc2486713a6d974aaf3780e0"
 dependencies = [
  "async-trait",
  "cgmath",
index c86b351717df36ad4fe624a0306313e958c4a0c1..385291f1c0dca438d756ad80ec0ec8762ddf462e 100644 (file)
@@ -6,7 +6,6 @@ use winit::{
     event::{DeviceEvent::*, Event::*, WindowEvent::*},
     event_loop::ControlFlow::ExitWithCode,
     platform::run_return::EventLoopExtRunReturn,
-    window::CursorGrabMode,
 };
 
 mod map;
@@ -106,7 +105,7 @@ pub async fn run(
             ..
         } => {
             if !game_paused {
-                state.camera.update_mouse(delta.0 as f32, delta.1 as f32);
+                state.camera.update_mouse(-delta.0 as f32, delta.1 as f32);
                 window
                     .set_cursor_position(winit::dpi::PhysicalPosition::new(
                         state.config.width / 2,
index 9d1cfd1a5ac8fd50d5adae7d105903dbb76dbef2..43ac41cb01d4679d1b1cd32dbabb59b016c23ee4 100644 (file)
@@ -177,10 +177,17 @@ impl State {
     }
 
     pub fn update(&mut self, dt: Duration) {
+        self.camera.yaw += Rad::from(Deg(180.0)).0;
+        self.camera.yaw *= -1.0;
+
         let cam = self.camera.camera(dt.as_secs_f32());
+
+        self.camera.yaw *= -1.0;
+        self.camera.yaw -= Rad::from(Deg(180.0)).0;
+
         self.camera.position = cam.position;
-        self.view = Matrix4::from(cam.orthogonal());
 
+        self.view = Matrix4::from(cam.orthogonal());
         self.camera_uniform.set(&self.queue, self.proj * self.view);
     }