diff --git a/Design.md b/Design.md index 8271a46..04ea6a9 100644 --- a/Design.md +++ b/Design.md @@ -37,7 +37,7 @@ Multiplayer - [x] Gun colliding with bullet, making it lower on every shot fired. - [x] Optics - [x] All optics implementing a fn/trait that gives a specific gun offset to use the optic correctly - - [ ] TODO: Find some way to implement a shader for the optics + - [ ] TODO: Find some way to implement a shader for the optics (AFTER IMPLEMENTING NEW BULLET SYSTEM) - [ ] Weapon Clipping - [ ] Make the player's collider bigger towards the front - [ ] Make the weapon's collider cover the firing point @@ -51,6 +51,8 @@ Multiplayer - [x] Create a Controls struct that holds mappings to all the game keys and replace them in all the game's code - [x] Gun dropping drops on only one side of player - [x] Gun dropping does not apply impulse for some reason... +- [ ] Gun colliding with ground and going into low ready +- [ ] With introduction of floor collision groups now bullets go through floors # Design diff --git a/assets/weapons/ak105_rifle.glb b/assets/weapons/ak105_rifle.glb index 439e9c9..718a3dd 100644 Binary files a/assets/weapons/ak105_rifle.glb and b/assets/weapons/ak105_rifle.glb differ diff --git a/src/comps/core/inventory/player_inventory.rs b/src/comps/core/inventory/player_inventory.rs index 39e5d2b..137fa03 100644 --- a/src/comps/core/inventory/player_inventory.rs +++ b/src/comps/core/inventory/player_inventory.rs @@ -93,10 +93,9 @@ pub fn drop_slot_in_game_world( let mut drop_position = Transform::from_translation( player_transform.translation + player_transform.up() * 5.0 - + player_transform.forward() * 5.0 + + player_transform.forward() * 2.0 ); drop_position.rotation = player_transform.rotation; - //drop_position.rotate_y(90.0f32.to_radians()); drop_position.rotate_y(-90.0f32.to_radians()); drop_position.rotate_x(45.0f32.to_radians()); drop_position.rotate_z(45.0f32.to_radians()); diff --git a/src/comps/core/markers/collider_flags.rs b/src/comps/core/markers/collider_flags.rs index 49d3e18..e5dec92 100644 --- a/src/comps/core/markers/collider_flags.rs +++ b/src/comps/core/markers/collider_flags.rs @@ -12,6 +12,8 @@ bitflags! { const SOLIDS = 0b00000100; const PLAYER = 0b00001000; + const FLOOR = 0b00010000; + const ALL = u32::MAX; const NONE = 0; } diff --git a/src/logic/core/guns/despawn_shots.rs b/src/logic/core/guns/despawn_shots.rs index 715bdd8..48cf5b8 100644 --- a/src/logic/core/guns/despawn_shots.rs +++ b/src/logic/core/guns/despawn_shots.rs @@ -1,6 +1,5 @@ use crate::comps::core::{markers::{bullet::BulletMarker, muzzle_flash::MuzzleFlashMarker}, events::{bullet_collision::BulletCollisionEvent, collision_event_type::CollisionEventType}}; use bevy::prelude::*; -use bevy_rapier3d::prelude::*; pub fn despawn_muzzle_flashes( mut commands: Commands, @@ -29,7 +28,7 @@ pub fn despawn_stray_bullets( match event.collision_type { CollisionEventType::Start => { - commands.entity(event.bullet).remove::(); + //commands.entity(event.bullet).remove::(); //commands.entity(bullet_entity).insert(Sensor); spawn_bullet_hit_marker( &mut commands, @@ -39,13 +38,12 @@ pub fn despawn_stray_bullets( ); }, CollisionEventType::End => { - for (bullet, bullet_entity, _) in query.iter() { + /*for (_, bullet_entity, _) in query.iter() { if bullet_entity != event.bullet { continue; } - println!("Happened"); - commands + /*commands .entity(event.bullet) - .insert(Collider::ball(bullet.caliber.size())); - } + .insert(Collider::ball(bullet.caliber.size()));*/ + }*/ //commands.entity(bullet_entity).remove::(); //commands.entity(*entity_b).despawn(); diff --git a/src/logic/core/guns/shoot.rs b/src/logic/core/guns/shoot.rs index b2a7dd8..cb5269f 100644 --- a/src/logic/core/guns/shoot.rs +++ b/src/logic/core/guns/shoot.rs @@ -127,8 +127,7 @@ pub fn spawn_bullet( torque_impulse: Vec3::ZERO, }, ActiveEvents::COLLISION_EVENTS, - CollisionGroups::new(Group::from_bits_retain(ColliderFlags::BULLETS.bits()), Group::from_bits_retain(ColliderFlags::SOLIDS.bits())), + CollisionGroups::new(Group::from_bits_retain(ColliderFlags::BULLETS.bits()), Group::from_bits_retain((ColliderFlags::SOLIDS | ColliderFlags::FLOOR).bits())), Ccd::enabled(), - )); } diff --git a/src/scenes/scene1/ground.rs b/src/scenes/scene1/ground.rs index 201faf0..9eaca9d 100644 --- a/src/scenes/scene1/ground.rs +++ b/src/scenes/scene1/ground.rs @@ -1,6 +1,8 @@ use bevy::prelude::*; use bevy_rapier3d::prelude::*; +use crate::comps::core::markers::collider_flags::ColliderFlags; + pub fn spawn_ground( mut commands: Commands, mut meshes: ResMut>, @@ -18,5 +20,6 @@ pub fn spawn_ground( ..default() }), ..default() - }); + }) + .insert(CollisionGroups::new(Group::from_bits_retain(ColliderFlags::FLOOR.bits()), Group::from_bits_retain(ColliderFlags::ALL.bits()))); }