Removed animations
This commit is contained in:
parent
b3abd36eff
commit
1b83befaad
@ -9,3 +9,20 @@ Examples:
|
||||
- Pistol grip should always be in the same position
|
||||
- Foregrip should be in the same position for same gun types
|
||||
|
||||
# UPDATE:
|
||||
Bevy isn't really ready yet for IK, multi-body animations, etc...
|
||||
Importing a character into bevy from blender is a nightmare. Hate to admit it but it's true. Maybe for 0.13 they work on it.
|
||||
Still, I can do many things without that.
|
||||
Mainly, Give love to the weapon system, movement, etc...
|
||||
|
||||
Modular weapons are not that crazy anymore, now that you have the blender->bevy workflow with custom properties, you can make it.
|
||||
|
||||
## Modular Weapons Design:
|
||||
### Important: ZERO ANIMATIONS. ALL PROCEDURAL
|
||||
|
||||
Limit mods to attachments, for now, I don't want to change barrel lengths or foregrips.
|
||||
Only do silencers/compensators, sights, Foregrips.
|
||||
|
||||
### Blender:
|
||||
- Mark every weapon parent with a FirearmEnum custom property
|
||||
- Mark Firing point
|
Binary file not shown.
Binary file not shown.
@ -1,15 +1,13 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_rapier3d::dynamics::Velocity;
|
||||
|
||||
use crate::{setup::{animations::AllAnimations, assets::GltfAssets}, comps::core::markers::{player::Player, proxy::character::player_character::PlayerCharacter}, ui::game::game_ui_state::GameUiState};
|
||||
use crate::{setup::assets::GltfAssets, comps::core::markers::{player::Player, proxy::character::player_character::PlayerCharacter}, ui::game::game_ui_state::GameUiState};
|
||||
|
||||
use super::player_movement::{PlayerLinearYState, PlayerLinearXZState};
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn animate_player(
|
||||
all_animations: Res<AllAnimations>,
|
||||
//all_animations: Res<AllAnimations>,
|
||||
assets_gltf: Res<GltfAssets>,
|
||||
player_query: Query<
|
||||
(
|
||||
@ -30,19 +28,19 @@ pub fn animate_player(
|
||||
for (player_velocity, player_linear_y_state, player_linear_xz_state) in player_query.iter() {
|
||||
for mut animation_player in player_character_animation_player_query.iter_mut() {
|
||||
if player_linear_xz_state.is_sprinting() {
|
||||
let clip_to_play = all_animations.character_animations.clone().expect("No Character animations in all_animations Resource").run_animation.clone_weak();
|
||||
/*let clip_to_play = all_animations.character_animations.clone().expect("No Character animations in all_animations Resource").run_animation.clone_weak();
|
||||
if !animation_player.is_playing_clip(&clip_to_play) {
|
||||
animation_player.start_with_transition(clip_to_play, Duration::from_millis(100));
|
||||
animation_player.set_speed(1.8);
|
||||
animation_player.set_speed(1.5);
|
||||
animation_player.repeat();
|
||||
}
|
||||
}*/
|
||||
} else {
|
||||
let clip_to_play = all_animations.character_animations.clone().expect("No Character animations in all_animations Resource").idle_animation.clone_weak();
|
||||
if !animation_player.is_playing_clip(&clip_to_play) {
|
||||
animation_player.play(clip_to_play);
|
||||
//let clip_to_play = all_animations.character_animations.clone().expect("No Character animations in all_animations Resource").idle_animation.clone_weak();
|
||||
//if !animation_player.is_playing_clip(&clip_to_play) {
|
||||
/*animation_player.play(clip_to_play);
|
||||
animation_player.set_speed(0.4);
|
||||
animation_player.repeat();
|
||||
}
|
||||
animation_player.repeat();*/
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ use crate::{
|
||||
logic::core::guns::{player_firing::PlayerFiringInfo, shoot::shoot_bullet},
|
||||
setup::{
|
||||
equipment::{Equipment, EquipmentChangeEvent},
|
||||
load_state::GameLoadState, assets::GltfAssets, animations::AllAnimations,
|
||||
load_state::GameLoadState, assets::GltfAssets, //animations::AllAnimations,
|
||||
},
|
||||
ui::game::{game_ui_state::GameUiState, hud::hud::HudState},
|
||||
utils::{self, rad_deg::radians_from_degrees},
|
||||
utils::rad_deg::radians_from_degrees,
|
||||
};
|
||||
|
||||
#[derive(SystemParam)]
|
||||
@ -30,8 +30,8 @@ pub struct CaptureHandUsageResourcesParams<'w> {
|
||||
game_ui_state: Res<'w, GameUiState>,
|
||||
meshes: ResMut<'w, Assets<Mesh>>,
|
||||
materials: ResMut<'w, Assets<StandardMaterial>>,
|
||||
animation_clips: Res<'w, Assets<AnimationClip>>,
|
||||
all_animations: Res<'w, AllAnimations>,
|
||||
//animation_clips: Res<'w, Assets<AnimationClip>>,
|
||||
//all_animations: Res<'w, AllAnimations>,
|
||||
time: Res<'w, Time>,
|
||||
assets_gltf: Res<'w, GltfAssets>,
|
||||
loaded_gltf_assets: Res<'w, Assets<Gltf>>,
|
||||
@ -53,9 +53,9 @@ pub fn capture_hand_usage(
|
||||
(With<InPlayerHands>, Without<InPlayerHandsParent>),
|
||||
>,
|
||||
mut player_query: Query<(&Player, &mut PlayerInventory, Entity, &Transform, &mut PlayerFiringInfo)>,
|
||||
mut animation_players: Query<(Entity, &mut AnimationPlayer)>,
|
||||
//mut animation_players: Query<(Entity, &mut AnimationPlayer)>,
|
||||
|
||||
children: Query<&Children>,
|
||||
//children: Query<&Children>,
|
||||
|
||||
mut equipment_change_event_writer: EventWriter<EquipmentChangeEvent>,
|
||||
mut inventory_changed_events: EventWriter<PlayerInventoryChangedEvent>,
|
||||
@ -115,16 +115,17 @@ pub fn capture_hand_usage(
|
||||
}
|
||||
|
||||
// Firearm stuff
|
||||
if let Equipment::Firearm(player_firearm) = player.0.equipment.clone() {
|
||||
if let Equipment::Firearm(_f) = player.0.equipment.clone() {
|
||||
player_firing_info
|
||||
.full_auto_timer
|
||||
.tick(resources.time.delta());
|
||||
|
||||
for (firearm_entity, firearm_transform, firearm_data, mut magazine_data) in
|
||||
for (_f, firearm_transform, firearm_data, mut magazine_data) in
|
||||
firearm_query.iter_mut()
|
||||
{
|
||||
for mut hand_transform in hand_query.iter_mut() {
|
||||
if player_firing_info.is_reloading {
|
||||
/* TODO:
|
||||
for (animation_player_entity, animation_player) in &mut animation_players {
|
||||
//children.get_component(entity)
|
||||
// Only reload if this animation_player_entity is a child of the firearm_entity
|
||||
@ -151,12 +152,13 @@ pub fn capture_hand_usage(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
} else {
|
||||
// Player is not in a reload animation
|
||||
if resources.keyboard_input.just_pressed(KeyCode::R)
|
||||
&& !resources.game_ui_state.any_window()
|
||||
{
|
||||
/*
|
||||
// Start reload animation
|
||||
for (animation_player_entity, mut animation_player) in
|
||||
&mut animation_players
|
||||
@ -179,7 +181,7 @@ pub fn capture_hand_usage(
|
||||
player_firing_info.is_reloading = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
// Set is_reloading = true
|
||||
// At the end of reload animation, set magazine data to capacity = 0
|
||||
}
|
||||
|
@ -163,7 +163,9 @@ pub fn move_player(
|
||||
if player_movement_input.back {
|
||||
if crouch_multiplier == player_values_state.player_crouch_speed_multiplier {
|
||||
} else {
|
||||
*player_linear_xz_state = PlayerLinearXZState::Walking;
|
||||
if !player_linear_xz_state.is_sprinting() && !player_linear_xz_state.is_crouched() {
|
||||
*player_linear_xz_state = PlayerLinearXZState::Walking;
|
||||
}
|
||||
}
|
||||
player_velocity.linvel = apply_movement_acceleration_to_vec(
|
||||
-forward,
|
||||
@ -176,7 +178,9 @@ pub fn move_player(
|
||||
if player_movement_input.right {
|
||||
if crouch_multiplier == player_values_state.player_crouch_speed_multiplier {
|
||||
} else {
|
||||
*player_linear_xz_state = PlayerLinearXZState::Walking;
|
||||
if !player_linear_xz_state.is_sprinting() && !player_linear_xz_state.is_crouched() {
|
||||
*player_linear_xz_state = PlayerLinearXZState::Walking;
|
||||
}
|
||||
}
|
||||
player_velocity.linvel = apply_movement_acceleration_to_vec(
|
||||
right,
|
||||
@ -195,7 +199,9 @@ pub fn move_player(
|
||||
if player_movement_input.left {
|
||||
if crouch_multiplier == player_values_state.player_crouch_speed_multiplier {
|
||||
} else {
|
||||
*player_linear_xz_state = PlayerLinearXZState::Walking;
|
||||
if !player_linear_xz_state.is_sprinting() && !player_linear_xz_state.is_crouched() {
|
||||
*player_linear_xz_state = PlayerLinearXZState::Walking;
|
||||
}
|
||||
}
|
||||
player_velocity.linvel = apply_movement_acceleration_to_vec(
|
||||
-right,
|
||||
@ -244,10 +250,10 @@ pub fn move_player(
|
||||
let positive = player_velocity.linvel.z.is_sign_positive();
|
||||
if positive {
|
||||
player_velocity.linvel.z =
|
||||
player_values_state.max_linear_player_velocity * crouch_multiplier
|
||||
player_values_state.max_linear_player_velocity * crouch_multiplier * sprint_multiplier
|
||||
} else {
|
||||
player_velocity.linvel.z =
|
||||
player_values_state.max_linear_player_velocity * -1.0 * crouch_multiplier
|
||||
player_values_state.max_linear_player_velocity * -1.0 * crouch_multiplier * sprint_multiplier
|
||||
}
|
||||
}
|
||||
if player_velocity.linvel.x > -1.0
|
||||
|
@ -52,7 +52,7 @@ impl Default for PlayerValuesState {
|
||||
player_linear_damping_while_jumping: 0.8,
|
||||
player_lean_time: 0.3,
|
||||
player_lean_angle: 30.0,
|
||||
player_lateral_acceleration_while_sprinting_multiplier: 0.2,
|
||||
player_lateral_acceleration_while_sprinting_multiplier: 0.8,
|
||||
player_lateral_acceleration_multiplier: 1.0,
|
||||
player_linear_damping_time_offset_after_jump_in_s: 0.02,
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ use crate::{
|
||||
},
|
||||
hands::{capture_hand_usage, interact_action},
|
||||
player_values_state::PlayerValuesState,
|
||||
player_vertical_sync::sync_player_y_state, animate_player::animate_player, camera_switching::switch_camera,
|
||||
player_vertical_sync::sync_player_y_state, camera_switching::switch_camera,
|
||||
},
|
||||
},
|
||||
setup::{
|
||||
animations::{load_animations, AllAnimations},
|
||||
//animations::{load_animations, AllAnimations},
|
||||
assets::load_all_assets,
|
||||
equipment::{change_equipment, EquipmentChangeEvent},
|
||||
load_state::GameLoadState,
|
||||
@ -33,7 +33,7 @@ use super::{
|
||||
pub fn load_scene(application: &mut App) {
|
||||
application.insert_resource(GameLoadState::default());
|
||||
application.insert_resource(MouseMovementSettings::default());
|
||||
application.insert_resource(AllAnimations::default());
|
||||
//application.insert_resource(AllAnimations::default());
|
||||
application.insert_resource(PlayerValuesState::default());
|
||||
|
||||
application.add_plugins(SpawnerPlugin);
|
||||
@ -49,7 +49,7 @@ pub fn load_scene(application: &mut App) {
|
||||
application.add_systems(Update, capture_input);
|
||||
application.add_systems(Update, sync_player_y_state);
|
||||
application.add_systems(Update, follow_cursor_with_camera);
|
||||
application.add_systems(Update, load_animations);
|
||||
//application.add_systems(Update, load_animations);
|
||||
|
||||
application.add_systems(Update, set_skybox_if_loaded);
|
||||
application.add_systems(Update, update_camera_vertical_position);
|
||||
@ -60,7 +60,7 @@ pub fn load_scene(application: &mut App) {
|
||||
application.add_systems(Update, change_equipment.before(player_spawner));
|
||||
application.add_systems(Update, (despawn_muzzle_flashes, despawn_stray_bullets));
|
||||
|
||||
application.add_systems(Update, animate_player);
|
||||
//application.add_systems(Update, animate_player);
|
||||
//application.add_systems(Update, register_bullet_hits);
|
||||
|
||||
application.add_event::<EquipmentChangeEvent>();
|
||||
|
@ -1,4 +1,4 @@
|
||||
use bevy::{gltf::Gltf, prelude::*};
|
||||
/*use bevy::{gltf::Gltf, prelude::*};
|
||||
|
||||
use crate::logic::core::guns::firearm::Firearm;
|
||||
|
||||
@ -55,9 +55,9 @@ pub fn load_animations(
|
||||
if let Some(loaded_gltf) = loaded_gltf_assets.get(&gltf_asset.asset) {
|
||||
// Needs to have all player_animations
|
||||
let initial_pose = &loaded_gltf.animations[0];
|
||||
let player_idle = &loaded_gltf.animations[1];
|
||||
let player_run = &loaded_gltf.animations[2];
|
||||
character_animations = Some(CharacterAnimations { run_animation: player_run.clone(), idle_animation: player_idle.clone(), initial_pose: initial_pose.clone() });
|
||||
//let player_idle = &loaded_gltf.animations[0];
|
||||
//let player_run = &loaded_gltf.animations[1];
|
||||
//character_animations = Some(CharacterAnimations { run_animation: player_run.clone(), idle_animation: player_idle.clone(), initial_pose: initial_pose.clone() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,3 +68,4 @@ pub fn load_animations(
|
||||
commands.insert_resource(all_animations);
|
||||
game_load_state.animations_loaded = true;
|
||||
}
|
||||
*/
|
@ -21,7 +21,7 @@ use crate::{
|
||||
},
|
||||
scenes::scene1::skybox::Cubemap,
|
||||
setup::{
|
||||
animations::{FirearmAnimations, AllAnimations},
|
||||
//animations::{FirearmAnimations, AllAnimations},
|
||||
assets::{GltfAssetType, GltfAssets},
|
||||
equipment::Equipment,
|
||||
load_state::GameLoadState,
|
||||
@ -55,8 +55,8 @@ impl Plugin for MainEditorUiPlugin {
|
||||
.register_type::<PlayerLinearXZState>()
|
||||
.register_type::<PlayerMovementInput>()
|
||||
.register_type::<Cubemap>()
|
||||
.register_type::<AllAnimations>()
|
||||
.register_type::<FirearmAnimations>()
|
||||
//.register_type::<AllAnimations>()
|
||||
//.register_type::<FirearmAnimations>()
|
||||
.register_type::<GltfAssetType>()
|
||||
.register_type::<GltfAssets>()
|
||||
.register_type::<Equipment>()
|
||||
|
Loading…
Reference in New Issue
Block a user