Fixed Gun dropping drops on only one side of player but impulse is not applied. Fix next
This commit is contained in:
parent
93a0fd88e4
commit
f910f4005b
|
@ -49,7 +49,8 @@ Multiplayer
|
|||
- [ ] Real world magazines
|
||||
- [ ] Rewriting bullet physics to use raycasts & kinematic rigidbodies (logic controlled)
|
||||
- [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
|
||||
- [ ] TODO: Gun dropping does not apply impulse for some reason...
|
||||
|
||||
# Design
|
||||
|
||||
|
|
|
@ -90,13 +90,19 @@ pub fn drop_slot_in_game_world(
|
|||
slot: PlayerInventorySlotType,
|
||||
item_state: Option<ItemState>,
|
||||
) {
|
||||
let drop_position = Transform::from_translation(
|
||||
let mut drop_position = Transform::from_translation(
|
||||
player_transform.translation
|
||||
+ player_transform.up() * 5.0
|
||||
+ player_transform.forward() * 5.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());
|
||||
let drop_impulse = player_transform.translation
|
||||
+ player_transform.up() * 100.0
|
||||
+ player_transform.forward() * 30.0;
|
||||
+ (player_transform.up() * 1000000.0)
|
||||
+ (player_transform.forward() * 3000000.0);
|
||||
|
||||
let item_inventory_slot = match slot {
|
||||
PlayerInventorySlotType::Primary => {
|
||||
|
|
|
@ -118,7 +118,7 @@ impl Item for Ak105GunItem {
|
|||
..Default::default()
|
||||
},
|
||||
RigidBody::Dynamic,
|
||||
ColliderMassProperties::Mass(5.0),
|
||||
ColliderMassProperties::Mass(0.1),
|
||||
GravityScale(4.0),
|
||||
ExternalImpulse {
|
||||
impulse: with_impulse,
|
||||
|
|
|
@ -10,6 +10,7 @@ bitflags! {
|
|||
const GUNS = 0b00000010;
|
||||
/// The value `C`, at bit position `2`.
|
||||
const SOLIDS = 0b00000100;
|
||||
const PLAYER = 0b00001000;
|
||||
|
||||
const ALL = u32::MAX;
|
||||
const NONE = 0;
|
||||
|
|
|
@ -4,7 +4,7 @@ use bevy_rapier3d::prelude::*;
|
|||
use crate::{
|
||||
comps::core::{
|
||||
inventory::player_inventory::PlayerInventory,
|
||||
markers::player::{Player, PlayerData},
|
||||
markers::{player::{Player, PlayerData}, collider_flags::ColliderFlags},
|
||||
},
|
||||
logic::core::{
|
||||
guns::player_firing::PlayerFiringInfo,
|
||||
|
@ -104,6 +104,7 @@ pub fn player_spawner(
|
|||
..Default::default()
|
||||
})
|
||||
// Data
|
||||
.insert(CollisionGroups::new(Group::from_bits_retain(ColliderFlags::PLAYER.bits()), Group::from_bits_retain(ColliderFlags::SOLIDS.bits())))
|
||||
.insert(PlayerFiringInfo::default())
|
||||
.insert(PlayerInventory::default())
|
||||
.add_child(player_scene);
|
||||
|
|
Loading…
Reference in New Issue