From a25b249bb8dfdcb9d4914b7d67d9682d901b24d9 Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 28 Mar 2024 23:38:24 +0100 Subject: [PATCH] enlarge the FoV at high adrenaline --- src/camera.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 5df76e0..ae8fc52 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -54,7 +54,7 @@ fn run_camera_controller( thruster_sound_controller: Query<&AudioSink, With>, rocket_sound_controller: Query<&AudioSink, With>, q_engine: Query<&actor::Engine, With>, - mut query: Query<(&mut Transform, &mut CameraController, &mut actor::Actor, &actor::Engine), With>, + mut query: Query<(&mut Transform, &mut CameraController, &mut Projection, &mut actor::Actor, &actor::LifeForm, &actor::Engine), With>, ) { let dt = time.delta_seconds(); let mut play_thruster_sound = false; @@ -65,7 +65,7 @@ fn run_camera_controller( focused = window_result.unwrap().focused; } - if let Ok((mut transform, mut controller, mut actor, player_engine)) = query.get_single_mut() { + if let Ok((mut transform, mut controller, mut projection, mut actor, lifeform, player_engine)) = query.get_single_mut() { if !controller.initialized { controller.initialized = true; transform.rotation = @@ -156,6 +156,9 @@ fn run_camera_controller( Quat::from_euler(EulerRot::ZYX, 0.0, controller.yaw, controller.pitch); } + let fov = (lifeform.adrenaline * lifeform.adrenaline * lifeform.adrenaline * 45.0 + 45.0).to_radians(); + *projection = Projection::Perspective(PerspectiveProjection { fov: fov, ..default() }); + if let Ok(sink) = thruster_sound_controller.get_single() { if play_thruster_sound && engine.engine_type == actor::EngineType::Monopropellant { sink.play()