Gun colliding with ground and going into low ready && With introduction of floor collision groups now bullets go through floors
This commit is contained in:
parent
f05cee114b
commit
087420fb28
@ -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
|
||||
|
||||
|
Binary file not shown.
@ -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());
|
||||
|
@ -12,6 +12,8 @@ bitflags! {
|
||||
const SOLIDS = 0b00000100;
|
||||
const PLAYER = 0b00001000;
|
||||
|
||||
const FLOOR = 0b00010000;
|
||||
|
||||
const ALL = u32::MAX;
|
||||
const NONE = 0;
|
||||
}
|
||||
|
@ -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::<Collider>();
|
||||
//commands.entity(event.bullet).remove::<Collider>();
|
||||
//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::<Sensor>();
|
||||
//commands.entity(*entity_b).despawn();
|
||||
|
@ -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(),
|
||||
|
||||
));
|
||||
}
|
||||
|
@ -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<Assets<Mesh>>,
|
||||
@ -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())));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user