diff --git a/Design.md b/Design.md index ed2b842..f125b3a 100644 --- a/Design.md +++ b/Design.md @@ -21,7 +21,7 @@ Multiplayer - [ ] Weapon Sway PENDING!!! - [x] Fixing leaning - [x] Snap back leaning too quick - - [ ] Issue with moving around quickly + - [x] Issue with moving around quickly - [ ] Bring Crouching back - [ ] Inspect animation (procedural) - [ ] Reload animation (procedural) diff --git a/assets/character/main_character.glb b/assets/character/main_character.glb index 500d9d5..986337b 100644 Binary files a/assets/character/main_character.glb and b/assets/character/main_character.glb differ diff --git a/assets/weapons/ak105_rifle.glb b/assets/weapons/ak105_rifle.glb index bae8dfe..2266a2f 100644 Binary files a/assets/weapons/ak105_rifle.glb and b/assets/weapons/ak105_rifle.glb differ diff --git a/src/comps/core/markers/proxy/character/player_eye.rs b/src/comps/core/markers/proxy/character/player_eye.rs index 9e6a81f..83f8cb3 100644 --- a/src/comps/core/markers/proxy/character/player_eye.rs +++ b/src/comps/core/markers/proxy/character/player_eye.rs @@ -3,7 +3,7 @@ use bevy_rapier3d::prelude::*; use crate::{comps::core::markers::{proxy::physics::rapier::LinkToPlayer, camera::MainCamera}, logic::core::player::player_values_state::PlayerValuesState}; -use super::third_person_camera::{ThirdPersonCameraProxy, ThirdPersonCamera}; +use super::{third_person_camera::{ThirdPersonCameraProxy, ThirdPersonCamera}, in_player_hands_parent::InPlayerHandsParent}; #[derive(Component, Reflect, Default, Debug)] @@ -15,6 +15,7 @@ pub fn insert_components_into_spawned_player( eye_query: Query>, third_person_camera_query: Query>, player_collider_query: Query, With, Added)>, + mut hand_query: Query<(Entity, &mut Transform), (With, Without, Without)>, player_values_state: Res, ) { for eye in eye_query.iter() { @@ -22,7 +23,7 @@ pub fn insert_components_into_spawned_player( let camera = commands .spawn(MainCamera) .insert(Camera3dBundle { - transform: Transform::from_xyz(0.0, 0.0, 0.0).looking_at(Vec3::ZERO, Vec3::Y), + transform: Transform::from_xyz(0.0, 0.0, 0.0), ..Default::default() }) //s.insert(Skybox(skybox_handle.clone())) @@ -32,6 +33,10 @@ pub fn insert_components_into_spawned_player( }) //.push_children(&[player_hand]) .id(); + for (hand, mut hand_transform) in hand_query.iter_mut() { + hand_transform.rotate_y(180.0f32.to_radians()); + commands.entity(hand).set_parent(camera); + } commands.entity(eye).add_child(camera); } for third_person_camera in third_person_camera_query.iter() { diff --git a/src/comps/core/weapons/firearm.rs b/src/comps/core/weapons/firearm.rs index 62dafaa..c446137 100644 --- a/src/comps/core/weapons/firearm.rs +++ b/src/comps/core/weapons/firearm.rs @@ -111,7 +111,7 @@ impl Firearm { }, final_aimed_rotation: Quat::default(), rotation_offset: Quat::default(), - final_aimed_position: Vec3 { x: 0.016, y: 0.0, z: -0.1 }, + final_aimed_position: Vec3 { x: 0.025, y: 0.003, z: -0.1 }, translation_offset: Vec3 { x: -0.2, y: -0.03, z: 0.0 }, scale_factor: 0.2, firearm_type: FirearmType::Primary, diff --git a/src/logic/core/guns/shoot.rs b/src/logic/core/guns/shoot.rs index ba54c5f..96db312 100644 --- a/src/logic/core/guns/shoot.rs +++ b/src/logic/core/guns/shoot.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use bevy::prelude::*; +use bevy::{prelude::*, render::render_resource::PrimitiveTopology}; use bevy_rapier3d::prelude::*; use crate::comps::core::{markers::{bullet::BulletMarker, muzzle_flash::MuzzleFlashMarker}, weapons::caliber::Caliber}; @@ -37,7 +37,7 @@ pub fn shoot_bullet( MuzzleFlashMarker(Timer::new(Duration::from_millis(10), TimerMode::Once)), )); // Spawn Line - /*commands.spawn( + commands.spawn( MaterialMeshBundle { mesh: { let mut mesh = Mesh::new(PrimitiveTopology::LineStrip); @@ -52,7 +52,7 @@ pub fn shoot_bullet( transform: firing_point, ..Default::default() } - );*/ + ); spawn_bullet( commands, diff --git a/src/logic/core/player/camera_player_sync.rs b/src/logic/core/player/camera_player_sync.rs index 08f642b..57d4d02 100644 --- a/src/logic/core/player/camera_player_sync.rs +++ b/src/logic/core/player/camera_player_sync.rs @@ -1,8 +1,8 @@ -use bevy::{input::mouse::MouseMotion, prelude::*, window::CursorGrabMode}; +use bevy::{input::mouse::MouseMotion, prelude::*, window::CursorGrabMode, ecs::system::SystemParam}; //use bevy_rapier3d::prelude::*; use crate::{ - comps::core::markers::{camera::MainCamera, player::Player, proxy::{physics::utils::F32Ext, character::player_character::PlayerCharacter}}, + comps::core::markers::{camera::MainCamera, player::Player, proxy::character::{player_character::PlayerCharacter, player_eye::PlayerEye}, holdable::InPlayerHands}, ui::game::game_ui_state::{GameUiState, GameUiWindow}, }; @@ -29,8 +29,8 @@ impl Default for MouseMovementSettings { /// Synchronizes camera's translation to player. pub fn update_camera_vertical_position( - mut player: Query<(&mut Transform, &PlayerLinearXZState), (With, Without)>, - mut camera: Query<&mut Transform, (With, Without)>, + mut player: Query<(&mut Transform, &PlayerLinearXZState), (With, Without)>, + mut camera: Query<&mut Transform, (With, Without)>, time: Res