/* Trouble in Terror Town: Community Edition Copyright (C) 2024 Mikolaj Wojciech Gorski This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License 3.0 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.0 for more details. You should have received a copy of the GNU General Public License 3.0 along with this program. If not, see . */ use crate::{charcacter_controller, input_processor::*, CharacterController}; use bevy::{ input::{ mouse::{MouseButtonInput, MouseMotion, MouseWheel}, touchpad::{TouchpadMagnify, TouchpadRotate}, }, prelude::*, }; pub struct PlayerLookPlugin; impl Plugin for PlayerLookPlugin { fn build(&self, app: &mut App) { app.add_systems(Update, rotate_camera); app.add_event::(); } } // marker for rotating playr horizontally #[derive(Component)] pub struct PlayerLookRotatatable; #[derive(Component)] pub struct PlayerCamera { mouse_gain: f32, rotation: Vec3, rotation_limit_top: f32, rotation_limit_bottom: f32, } impl Default for PlayerCamera { fn default() -> Self { Self { mouse_gain: 0.005, rotation: Vec3 { x: 0.0, y: 0.0, z: 0.0, }, rotation_limit_top: 1.0, rotation_limit_bottom: -1.0, } } } fn rotate_camera( time: Res