diff --git a/assets/weapons/ar_15_rifle_base.glb b/assets/weapons/m4a1_rifle.glb similarity index 85% rename from assets/weapons/ar_15_rifle_base.glb rename to assets/weapons/m4a1_rifle.glb index d3caee4..3b804c4 100644 Binary files a/assets/weapons/ar_15_rifle_base.glb and b/assets/weapons/m4a1_rifle.glb differ diff --git a/src/comps/core/holdable/holdable.rs b/src/comps/core/holdable/holdable.rs deleted file mode 100644 index dcaa98c..0000000 --- a/src/comps/core/holdable/holdable.rs +++ /dev/null @@ -1,35 +0,0 @@ -use bevy::prelude::*; - -use bevy::gltf::Gltf; - -#[derive(Resource)] -pub struct LoadedAsset(Handle); - -fn load_gltf( - mut commands: Commands, - ass: Res, -) { - let gltf = ass.load("my_asset_pack.glb"); - commands.insert_resource(LoadedAsset(gltf)); -} - -/// Anything that can go in the player's hands. -pub struct HoldableObject { - pub transform: Transform, - /// Initial Rotation in degrees - pub y_rot: f32, - pub asset_handle: Handle, - -} - -impl HoldableObject { - pub fn spawn_in_world(&mut self, mut commands: Commands) -> Entity { - commands.spawn(SceneBundle { - scene: todo!(), - transform: todo!(), - global_transform: todo!(), - visibility: todo!(), - computed_visibility: todo!(), - }).id() - } -} \ No newline at end of file diff --git a/src/comps/core/holdable/mod.rs b/src/comps/core/holdable/mod.rs deleted file mode 100644 index ac1b12d..0000000 --- a/src/comps/core/holdable/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod holdable; \ No newline at end of file diff --git a/src/comps/core/camera.rs b/src/comps/core/markers/camera.rs similarity index 100% rename from src/comps/core/camera.rs rename to src/comps/core/markers/camera.rs diff --git a/src/comps/core/markers/holdable.rs b/src/comps/core/markers/holdable.rs new file mode 100644 index 0000000..64df3f8 --- /dev/null +++ b/src/comps/core/markers/holdable.rs @@ -0,0 +1,10 @@ +use bevy::prelude::*; + +/// Anything that can go in the player's hands. +#[derive(Component, Default, Debug)] +pub struct HoldableObject { + /// Where this object should be placed relative to the hand. + pub held_at: Vec3, + /// Initial Rotation in degrees + pub y_rot: f32, +} \ No newline at end of file diff --git a/src/comps/core/markers/mod.rs b/src/comps/core/markers/mod.rs index f28d7c2..0f96a4a 100644 --- a/src/comps/core/markers/mod.rs +++ b/src/comps/core/markers/mod.rs @@ -1 +1,3 @@ pub mod player; +pub mod holdable; +pub mod camera; \ No newline at end of file diff --git a/src/comps/core/mod.rs b/src/comps/core/mod.rs index 869845d..960b3c0 100644 --- a/src/comps/core/mod.rs +++ b/src/comps/core/mod.rs @@ -1,4 +1,2 @@ -pub mod camera; pub mod controller; -pub mod markers; -pub mod holdable; \ No newline at end of file +pub mod markers; \ No newline at end of file diff --git a/src/logic/core/player/camera_player_sync.rs b/src/logic/core/player/camera_player_sync.rs index eeb7b68..4fc71d4 100644 --- a/src/logic/core/player/camera_player_sync.rs +++ b/src/logic/core/player/camera_player_sync.rs @@ -2,7 +2,7 @@ use bevy::{input::mouse::MouseMotion, prelude::*}; //use bevy_rapier3d::prelude::*; use crate::{ - comps::core::{camera::MainCamera, markers::player::Player}, + comps::core::markers::{player::Player, camera::MainCamera}, constants::player_values::{PLAYER_CAMERA_HEIGHT, PLAYER_CROUCH_HEIGHT, PLAYER_CROUCH_TIME_MS}, }; diff --git a/src/logic/core/player/spawn_player.rs b/src/logic/core/player/spawn_player.rs index 2b981ae..4e5322c 100644 --- a/src/logic/core/player/spawn_player.rs +++ b/src/logic/core/player/spawn_player.rs @@ -2,7 +2,7 @@ use bevy::{core_pipeline::Skybox, prelude::*}; use bevy_rapier3d::prelude::*; use crate::{ - comps::core::{camera::MainCamera, markers::player::{Player, PlayerHand}}, + comps::core::markers::{player::{Player, PlayerHand}, camera::MainCamera}, constants::player_values::{ PLAYER_GRAVITY_SCALE, PLAYER_HEIGHT, PLAYER_INITIAL_WEIGHT, PLAYER_LINEAR_DAMPING, }, @@ -17,7 +17,7 @@ pub fn spawn_player(mut commands: Commands, asset_server: Res) { let mut ar_15_transform = Transform::from_xyz(0.0, 0.0, 0.0); ar_15_transform.rotate_y(utils::rad_deg::radians_from_degrees(-90.0)); let ar_15 = commands.spawn(SceneBundle { - scene: asset_server.load("weapons/ar_15_rifle_base.glb#Scene0"), + scene: asset_server.load("weapons/m4a1_rifle.glb#Scene0"), visibility: Visibility::Inherited, transform: ar_15_transform, ..default() diff --git a/src/setup/gltf_assets.rs b/src/setup/gltf_assets.rs new file mode 100644 index 0000000..2136bf2 --- /dev/null +++ b/src/setup/gltf_assets.rs @@ -0,0 +1,15 @@ +use bevy::prelude::*; + +use bevy::gltf::Gltf; + +#[derive(Resource)] +pub struct LoadedAsset(Handle); + +/// Loads gltf asset into AssetServer. Inserts Resource as a LoadedAsset +pub fn load_gltf( + mut commands: Commands, + ass: Res, +) { + let gltf = ass.load("my_asset_pack.glb"); + commands.insert_resource(LoadedAsset(gltf)); +} \ No newline at end of file diff --git a/src/setup/mod.rs b/src/setup/mod.rs index 8b13789..cdfbf67 100644 --- a/src/setup/mod.rs +++ b/src/setup/mod.rs @@ -1 +1,2 @@ +pub mod gltf_assets; \ No newline at end of file