diff --git a/assets/voxygen/voxel/figure/head/head_danari_female.vox b/assets/voxygen/voxel/figure/head/head_danari_female.vox index e01876e317..24d440444d 100644 --- a/assets/voxygen/voxel/figure/head/head_danari_female.vox +++ b/assets/voxygen/voxel/figure/head/head_danari_female.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18899c4dfb1dba8730a097ae5d904688338cc74a7dbc083cb51d3f1b910e9ef7 +oid sha256:8ec064ea2e1681c1a002500a0a32ed92baaa67fe9a2c09aab24800833d8e0ea4 size 4288 diff --git a/common/src/comp/animation.rs b/common/src/comp/animation.rs index e59a506148..2ad33aa8db 100644 --- a/common/src/comp/animation.rs +++ b/common/src/comp/animation.rs @@ -10,6 +10,7 @@ pub enum Animation { Roll, Crun, Cidle, + Cjump, } #[derive(Copy, Clone, Debug, Serialize, Deserialize)] diff --git a/common/src/comp/inputs.rs b/common/src/comp/inputs.rs index 66c51d634b..f03a5706b6 100644 --- a/common/src/comp/inputs.rs +++ b/common/src/comp/inputs.rs @@ -13,6 +13,12 @@ pub struct Attacking { pub applied: bool, } +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +pub struct Wielding { + pub time: f32, + pub applied: bool, +} + #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct Rolling { pub time: f32, @@ -41,6 +47,15 @@ impl Attacking { } } +impl Wielding { + pub fn start() -> Self { + Self { + time: 0.0, + applied: false, + } + } +} + impl Rolling { pub fn start() -> Self { Self { @@ -58,6 +73,10 @@ impl Component for Attacking { type Storage = FlaggedStorage>; } +impl Component for Wielding { + type Storage = FlaggedStorage>; +} + impl Component for Rolling { type Storage = FlaggedStorage>; } diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index 8723cf8b0b..913a9d4664 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -15,7 +15,7 @@ pub use agent::Agent; pub use animation::{Animation, AnimationInfo}; pub use body::{humanoid, quadruped, quadruped_medium, Body}; pub use controller::Controller; -pub use inputs::{Attacking, Gliding, Jumping, MoveDir, OnGround, Respawning, Rolling}; +pub use inputs::{Attacking, Gliding, Jumping, MoveDir, Wielding, OnGround, Respawning, Rolling}; pub use inventory::{item, Inventory}; pub use phys::{ForceUpdate, Ori, Pos, Vel}; pub use player::Player; diff --git a/common/src/state.rs b/common/src/state.rs index 584426d79c..aede2a9ab1 100644 --- a/common/src/state.rs +++ b/common/src/state.rs @@ -111,6 +111,7 @@ impl State { ecs.register::(); ecs.register::(); ecs.register::(); + ecs.register::(); ecs.register::(); ecs.register::(); ecs.register::(); diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index cebb5dde07..53234f0773 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -21,6 +21,7 @@ impl<'a> System<'a> for Sys { Animation::Idle } +<<<<<<< HEAD let animation = match (a.on_ground, a.moving, a.attacking, a.gliding, a.rolling) { (_, _, true, true, _) => impossible_animation("Attack while gliding"), (_, _, true, _, true) => impossible_animation("Roll while attacking"), diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 162dee392d..0861fa30f3 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -1,6 +1,6 @@ use crate::{ comp::{ - Attacking, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel}, + Attacking, Wielding, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel}, }, state::{DeltaTime, Uid}, }; @@ -18,6 +18,7 @@ impl<'a> System<'a> for Sys { ReadStorage<'a, Ori>, WriteStorage<'a, Vel>, WriteStorage<'a, Attacking>, + WriteStorage<'a, Wielding>, WriteStorage<'a, Stats>, WriteStorage<'a, ForceUpdate>, ); @@ -32,6 +33,7 @@ impl<'a> System<'a> for Sys { orientations, mut velocities, mut attackings, + mut wieldings, mut stats, mut force_updates, ): Self::SystemData, @@ -67,6 +69,7 @@ impl<'a> System<'a> for Sys { Some(entity) } else { attacking.time += dt.0; + None } }) diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index 283f10bcb0..b30a3d9d97 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -52,17 +52,23 @@ impl Animation for AttackAnimation { next.l_hand.offset = Vec3::new( -8.0 + wave_quicken_slow * 10.0, - 4.0 + wave_quicken_double * 3.0, - 9.0, + 8.0 + wave_quicken_double * 3.0, + 0.0, ); next.l_hand.ori = Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) * Quaternion::rotation_y(0.0 + wave_quicken * -0.4); - next.l_hand.scale = Vec3::one(); + next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new(0.0, -2.0, 6.5) / 11.0; - next.r_hand.ori = Quaternion::rotation_x(0.0); - next.r_hand.scale = Vec3::one() * 0.0; + next.r_hand.offset = Vec3::new( + -8.0 + wave_quicken_slow * 10.0, + 8.0 + wave_quicken_double * 3.0, + -2.0, + ); + next.r_hand.ori = Quaternion::rotation_z(-0.8) + * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) + * Quaternion::rotation_y(0.0 + wave_quicken * -0.4); + next.r_hand.scale = Vec3::one() * 1.01; next.l_foot.offset = Vec3::new( -3.4, @@ -81,12 +87,14 @@ impl Animation for AttackAnimation { next.r_foot.scale = Vec3::one(); next.weapon.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -2.0 + skeleton_attr.weapon_y, - 5.0, + -8.0 + wave_quicken_slow * 10.0 + skeleton_attr.weapon_x, + 8.0 + wave_quicken_double * 3.0, + 0.0, ); - next.weapon.ori = Quaternion::rotation_y(2.5); - next.weapon.scale = Vec3::one() * 0.0; + next.weapon.ori = Quaternion::rotation_z(-0.8) + * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) + * Quaternion::rotation_y(0.0 + wave_quicken * -0.4); + next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); @@ -100,28 +108,6 @@ impl Animation for AttackAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.left_equip.offset = Vec3::new( - -8.0 + wave_quicken_slow * 10.0 + skeleton_attr.weapon_x, - 4.0 + wave_quicken_double * 3.0, - 9.0, - ) / 11.0 - * skeleton_attr.scaler; - next.left_equip.ori = Quaternion::rotation_z(-0.8) - * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) - * Quaternion::rotation_y(0.0 + wave_quicken * -0.4); - next.left_equip.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - - next.right_equip.offset = Vec3::new( - -8.0 + wave_quicken_slow * 10.0, - 4.0 + wave_quicken_double * 3.0, - 9.0, - ) / 11.0 - * skeleton_attr.scaler; - next.right_equip.ori = Quaternion::rotation_z(-0.8) - * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) - * Quaternion::rotation_y(0.0 + wave_quicken * -0.4); - next.right_equip.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_z(wave_stop_quick * -0.2) * Quaternion::rotation_x(0.0 + wave_stop_quick * -0.2) diff --git a/voxygen/src/anim/character/cidle.rs b/voxygen/src/anim/character/cidle.rs index afdc76ea71..33c84f3d4d 100644 --- a/voxygen/src/anim/character/cidle.rs +++ b/voxygen/src/anim/character/cidle.rs @@ -5,6 +5,9 @@ use super::{ use std::{f32::consts::PI, ops::Mul}; use vek::*; +pub struct Input { + pub attack: bool, +} pub struct CidleAnimation; impl Animation for CidleAnimation { @@ -19,65 +22,82 @@ impl Animation for CidleAnimation { ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); - let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos(); + let wave = (anim_time as f32 * 4.0).sin(); + + let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin(); + let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos(); + let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); + let wave_slow = (anim_time as f32 * 6.0 + PI).sin(); + + let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) + ((global_time + anim_time) as f32 / 1.5) .floor() .mul(7331.0) .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) + * 0.3, + ((global_time + anim_time) as f32 / 1.5) .floor() .mul(1337.0) .sin() - * 0.25, + * 0.15, ); - next.head.offset = Vec3::new(0.0, 2.0, 11.0 + wave_ultra_slow * 0.3); - next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y); - next.head.scale = Vec3::one(); + next.head.offset = Vec3::new( + 0.0 + skeleton_attr.neck_right + wave_slow_cos * 0.5, + 0.0 + skeleton_attr.neck_forward, + skeleton_attr.neck_height + 15.0 + wave_ultra_slow * 0.6, + ); + next.head.ori = + Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs()); + next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_ultra_slow * 0.3); - next.chest.ori = Quaternion::rotation_x(0.0); + next.chest.offset = Vec3::new(0.0 + wave_slow_cos * 0.5, 0.0, 7.0 + wave_ultra_slow * 0.5); + next.chest.ori = Quaternion::rotation_y(wave_ultra_slow_cos * 0.04); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_ultra_slow * 0.3); - next.belt.ori = Quaternion::rotation_x(0.0); + next.belt.offset = Vec3::new(0.0 + wave_slow_cos * 0.5, 0.0, 5.0 + wave_ultra_slow * 0.5); + next.belt.ori = Quaternion::rotation_y(wave_ultra_slow_cos * 0.03); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_ultra_slow * 0.3); + next.shorts.offset = Vec3::new(0.0 + wave_slow_cos * 0.5, 0.0, 2.0 + wave_ultra_slow * 0.5); next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -7.5, - -2.0 + wave_ultra_slow_cos * 0.15, - 8.0 + wave_ultra_slow * 0.5, - ) / 11.0; + -6.0 + wave_ultra_slow_cos * 1.0, + 3.5 + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); - next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); - next.l_hand.scale = Vec3::one() / 11.0; + next.l_hand.ori = Quaternion::rotation_x(-0.3); + next.l_hand.scale = Vec3::one() * 1.01; next.r_hand.offset = Vec3::new( - 7.5, - -2.0 + wave_ultra_slow_cos * 0.15, - 8.0 + wave_ultra_slow * 0.5, - ) / 11.0; - next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); - next.r_hand.scale = Vec3::one() / 11.; + -6.0 + wave_ultra_slow_cos * 1.0, + 3.0 + wave_ultra_slow_cos * 0.5, + -2.0 + wave_ultra_slow * 1.0, + ); + next.r_hand.ori = Quaternion::rotation_x(-0.3); + next.r_hand.scale = Vec3::one() * 1.01; - next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0); - next.l_foot.ori = Quaternion::identity(); + next.l_foot.offset = Vec3::new(-3.4, -1.5, 8.0 + wave_slow * 0.2); + next.l_foot.ori = Quaternion::rotation_x(wave_ultra_slow_cos * 0.015); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0); - next.r_foot.ori = Quaternion::identity(); + next.r_foot.offset = Vec3::new(3.4, 3.0, 8.0 + wave_slow_cos * 0.2); + next.r_foot.ori = Quaternion::rotation_x(wave_ultra_slow * 0.015); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0); - next.weapon.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); - next.weapon.scale = Vec3::one() * 0.0; + next.weapon.offset = Vec3::new( + -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, + 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, + 0.0 + wave_ultra_slow * 1.0, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); @@ -91,17 +111,9 @@ impl Animation for CidleAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.left_equip.ori = Quaternion::rotation_x(0.0);; - next.left_equip.scale = Vec3::one() * 0.0; - - next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.right_equip.ori = Quaternion::rotation_x(0.0);; - next.right_equip.scale = Vec3::one() * 0.0; - - next.torso.offset = Vec3::new(0.0, -0.2, 0.1); + next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(0.0); - next.torso.scale = Vec3::one() / 11.0; + next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next } diff --git a/voxygen/src/anim/character/cjump.rs b/voxygen/src/anim/character/cjump.rs new file mode 100644 index 0000000000..2bfafd30cc --- /dev/null +++ b/voxygen/src/anim/character/cjump.rs @@ -0,0 +1,98 @@ +use super::{ + super::{Animation, SkeletonAttr}, + CharacterSkeleton, +}; +use std::f32::consts::PI; +use vek::*; + +pub struct CjumpAnimation; + +impl Animation for CjumpAnimation { + type Skeleton = CharacterSkeleton; + type Dependency = f64; + + fn update_skeleton( + skeleton: &Self::Skeleton, + global_time: f64, + anim_time: f64, + skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + let wave = (anim_time as f32 * 14.0).sin(); + let wave_slow = (anim_time as f32 * 7.0).sin(); + let wave_stop = (anim_time as f32 * 4.5).min(PI / 2.0).sin(); + let wave_stop_alt = (anim_time as f32 * 5.0).min(PI / 2.0).sin(); + + next.head.offset = Vec3::new( + 0.0 + skeleton_attr.neck_right, + 0.0 + skeleton_attr.neck_forward, + skeleton_attr.neck_height + 15.0, + ); + next.head.ori = Quaternion::rotation_x(0.25 + wave_stop * 0.1 + wave_slow * 0.04); + next.head.scale = Vec3::one() * skeleton_attr.head_scale; + + next.chest.offset = Vec3::new(0.0, 0.0, 8.0); + next.chest.ori = Quaternion::rotation_z(0.0); + next.chest.scale = Vec3::one(); + + next.belt.offset = Vec3::new(0.0, 0.0, 6.0); + next.belt.ori = Quaternion::rotation_z(0.0); + next.belt.scale = Vec3::one(); + + next.shorts.offset = Vec3::new(0.0, 0.0, 3.0); + next.shorts.ori = Quaternion::rotation_z(0.0); + next.shorts.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new( + -7.0, + 4.0, + 0.0 + wave_stop * 2.0, + ); + next.l_hand.ori = Quaternion::rotation_x(-0.3); + next.l_hand.scale = Vec3::one(); + + next.r_hand.offset = Vec3::new( + -7.0, + 3.0, + -2.0 + wave_stop * 2.0, + ); + next.r_hand.ori = Quaternion::rotation_x(-0.3); + next.r_hand.scale = Vec3::one(); + + next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0); + next.l_foot.ori = Quaternion::rotation_x(wave_stop * -1.2 - wave_slow * 0.2); + next.l_foot.scale = Vec3::one(); + + next.r_foot.offset = Vec3::new(3.4, -1.0, 6.0); + next.r_foot.ori = Quaternion::rotation_x(wave_stop * 1.2 + wave_slow * 0.2); + next.r_foot.scale = Vec3::one(); + + next.weapon.offset = Vec3::new( + -7.0 + skeleton_attr.weapon_x, + 4.0 + skeleton_attr.weapon_y, + 0.0 + wave_stop * 2.0, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.weapon.scale = Vec3::one(); + + next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5); + next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.scale = Vec3::one() * 1.04; + + next.r_shoulder.offset = Vec3::new(0.0, -3.2, 2.5); + next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.scale = Vec3::one() * 1.04; + + next.draw.offset = Vec3::new(0.0, 5.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.torso.offset = Vec3::new(0.0, -0.2, 0.0) * skeleton_attr.scaler; + next.torso.ori = Quaternion::rotation_x(-0.2); + next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; + + next + } +} diff --git a/voxygen/src/anim/character/crun.rs b/voxygen/src/anim/character/crun.rs index cd7e423733..96dd7d4166 100644 --- a/voxygen/src/anim/character/crun.rs +++ b/voxygen/src/anim/character/crun.rs @@ -2,6 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, CharacterSkeleton, }; +use std::f32::consts::PI; use std::ops::Mul; use vek::*; @@ -19,8 +20,11 @@ impl Animation for CrunAnimation { ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let wave = (anim_time as f32 * 14.0).sin(); - let wave_cos = (anim_time as f32 * 14.0).cos(); + let wave = (anim_time as f32 * 12.0).sin(); + let wave_cos = (anim_time as f32 * 12.0).cos(); + let wave_diff = (anim_time as f32 * 12.0 + PI / 2.0).sin(); + let wave_cos_dub = (anim_time as f32 * 24.0).cos(); + let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin(); let head_look = Vec2::new( ((global_time + anim_time) as f32 / 2.0) @@ -35,10 +39,14 @@ impl Animation for CrunAnimation { * 0.1, ); - next.head.offset = Vec3::new(0.0, 3.0, 12.0 + wave_cos * 1.3); + next.head.offset = Vec3::new( + 0.0, + -1.0 + skeleton_attr.neck_forward, + skeleton_attr.neck_height + 15.0 + wave_cos * 1.3, + ); next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1) * Quaternion::rotation_x(head_look.y + 0.35); - next.head.scale = Vec3::one(); + next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 1.1); next.chest.ori = Quaternion::rotation_z(wave * 0.1); @@ -52,25 +60,39 @@ impl Animation for CrunAnimation { next.shorts.ori = Quaternion::rotation_z(wave * 0.6); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-9.0, 3.0 + wave_cos * 8.0, 12.0 - wave * 1.0) / 11.0; - next.l_hand.ori = Quaternion::rotation_x(wave_cos * 1.1); - next.l_hand.scale = Vec3::one() / 11.0; + next.l_hand.offset = Vec3::new( + -6.0, + 4.0, + 0.0, + ); + next.l_hand.ori = Quaternion::rotation_x(-0.3); + next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(9.0, 3.0 - wave_cos * 8.0, 12.0 + wave * 1.0) / 11.0; - next.r_hand.ori = Quaternion::rotation_x(wave_cos * -1.1); - next.r_hand.scale = Vec3::one() / 11.0; + next.r_hand.offset = Vec3::new( + -6.0, + 3.0, + -2.0, + ); + next.r_hand.ori = Quaternion::rotation_x(-0.3); + next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0); + next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0 - wave_cos_dub * 0.11); next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.5); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0); + next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0 - wave_cos_dub * 0.11); next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0); - next.weapon.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); - next.weapon.scale = Vec3::one() * 0.0; + next.weapon.offset = Vec3::new( + -6.0 + skeleton_attr.weapon_x, + 4.0, + 0.0, + ); + next.weapon.ori = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); @@ -84,17 +106,11 @@ impl Animation for CrunAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.left_equip.ori = Quaternion::rotation_x(0.0);; - next.left_equip.scale = Vec3::one() * 0.0; - - next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.right_equip.ori = Quaternion::rotation_x(0.0);; - next.right_equip.scale = Vec3::one() * 0.0; - - next.torso.offset = Vec3::new(0.0, -0.2, 0.4); - next.torso.ori = Quaternion::rotation_x(-velocity * 0.04 - wave_cos * 0.10); - next.torso.scale = Vec3::one() / 11.0; + next.torso.offset = + Vec3::new(0.0, -0.2 + wave * -0.08, 0.4 + wave_cos_dub * 0.11) * skeleton_attr.scaler; + next.torso.ori = + Quaternion::rotation_x(wave_stop * velocity * -0.06 + wave_diff * velocity * -0.005); + next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next } diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 2edfa8c05f..3df382b709 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -103,14 +103,6 @@ impl Animation for GlidingAnimation { * Quaternion::rotation_y(wave_very_slow_cos * 0.04); next.draw.scale = Vec3::one(); - next.left_equip.offset = Vec3::new(0.0, 0.0, -5.0) / 11.0; - next.left_equip.ori = Quaternion::rotation_x(0.0);; - next.left_equip.scale = Vec3::one() * 0.0; - - next.right_equip.offset = Vec3::new(0.0, 0.0, -5.0) / 11.0; - next.right_equip.ori = Quaternion::rotation_x(0.0); - next.right_equip.scale = Vec3::one() * 0.0; - next.torso.offset = Vec3::new(0.0, 6.0, 15.0) / 11.0 * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(-0.05 * velocity + wave_very_slow * 0.10); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index d74f8843b3..f9f363c923 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -63,7 +63,7 @@ impl Animation for IdleAnimation { next.l_hand.offset = Vec3::new( -7.5, 0.0 + wave_ultra_slow_cos * 0.15, - 7.0 + wave_ultra_slow * 0.5, + 0.0 + wave_ultra_slow * 0.5, ); next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06); @@ -72,7 +72,7 @@ impl Animation for IdleAnimation { next.r_hand.offset = Vec3::new( 7.5, 0.0 + wave_ultra_slow_cos * 0.15, - 7.0 + wave_ultra_slow * 0.5, + 0.0 + wave_ultra_slow * 0.5, ); next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06); next.r_hand.scale = Vec3::one(); @@ -105,14 +105,6 @@ impl Animation for IdleAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.left_equip.ori = Quaternion::rotation_x(0.0);; - next.left_equip.scale = Vec3::one() * 0.0; - - next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.right_equip.ori = Quaternion::rotation_x(0.0);; - next.right_equip.scale = Vec3::one() * 0.0; - next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index 223f1c7e18..30f9dcb628 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -46,7 +46,7 @@ impl Animation for JumpAnimation { next.l_hand.offset = Vec3::new( -8.0, 0.0 + wave_stop * 3.8, - 7.0 + wave_stop * 3.2 - wave * 0.4, + 0.0 + wave_stop * 3.2 - wave * 0.4, ); next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 0.6); next.l_hand.scale = Vec3::one(); @@ -54,7 +54,7 @@ impl Animation for JumpAnimation { next.r_hand.offset = Vec3::new( 8.0, 0.0 + wave_stop * -3.8, - 7.0 + wave_stop * 3.2 - wave * 0.4, + 0.0 + wave_stop * 3.2 - wave * 0.4, ); next.r_hand.ori = Quaternion::rotation_x(-wave_stop_alt * 0.6); next.r_hand.scale = Vec3::one(); @@ -87,14 +87,6 @@ impl Animation for JumpAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.left_equip.ori = Quaternion::rotation_x(0.0);; - next.left_equip.scale = Vec3::one() * 0.0; - - next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.right_equip.ori = Quaternion::rotation_x(0.0);; - next.right_equip.scale = Vec3::one() * 0.0; - next.torso.offset = Vec3::new(0.0, -0.2, 0.0) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(-0.2); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 0285413e21..3a4e6c3055 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -1,6 +1,7 @@ pub mod attack; pub mod cidle; pub mod crun; +pub mod cjump; pub mod gliding; pub mod idle; pub mod jump; @@ -11,6 +12,7 @@ pub mod run; pub use self::attack::AttackAnimation; pub use self::cidle::CidleAnimation; pub use self::crun::CrunAnimation; +pub use self::cjump::CjumpAnimation; pub use self::gliding::GlidingAnimation; pub use self::idle::IdleAnimation; pub use self::jump::JumpAnimation; @@ -36,8 +38,6 @@ pub struct CharacterSkeleton { l_shoulder: Bone, r_shoulder: Bone, draw: Bone, - left_equip: Bone, - right_equip: Bone, torso: Bone, } @@ -56,8 +56,6 @@ impl CharacterSkeleton { l_shoulder: Bone::default(), r_shoulder: Bone::default(), draw: Bone::default(), - left_equip: Bone::default(), - right_equip: Bone::default(), torso: Bone::default(), } } @@ -75,18 +73,19 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::new(torso_mat * chest_mat), FigureBoneData::new(torso_mat * self.belt.compute_base_matrix()), FigureBoneData::new(torso_mat * self.shorts.compute_base_matrix()), - FigureBoneData::new(torso_mat * l_hand_mat), - FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()), + FigureBoneData::new(torso_mat * chest_mat * l_hand_mat), + FigureBoneData::new(torso_mat * chest_mat * self.r_hand.compute_base_matrix()), FigureBoneData::new(torso_mat * self.l_foot.compute_base_matrix()), FigureBoneData::new(torso_mat * self.r_foot.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * weapon_mat), FigureBoneData::new(torso_mat * chest_mat * self.l_shoulder.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * self.r_shoulder.compute_base_matrix()), FigureBoneData::new(torso_mat * self.draw.compute_base_matrix()), - FigureBoneData::new(self.left_equip.compute_base_matrix()), - FigureBoneData::new(self.right_equip.compute_base_matrix()), FigureBoneData::new(torso_mat), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] } @@ -103,8 +102,6 @@ impl Skeleton for CharacterSkeleton { self.l_shoulder.interpolate(&target.l_shoulder, dt); self.r_shoulder.interpolate(&target.r_shoulder, dt); self.draw.interpolate(&target.draw, dt); - self.left_equip.interpolate(&target.left_equip, dt); - self.right_equip.interpolate(&target.right_equip, dt); self.torso.interpolate(&target.torso, dt); } } diff --git a/voxygen/src/anim/character/roll.rs b/voxygen/src/anim/character/roll.rs index fd43915e91..f4171024e8 100644 --- a/voxygen/src/anim/character/roll.rs +++ b/voxygen/src/anim/character/roll.rs @@ -49,7 +49,7 @@ impl Animation for RollAnimation { next.l_hand.offset = Vec3::new( -5.5 + wave * -0.5, -2.0 + wave_quick_cos * -5.5, - 8.0 + wave_quick * 0.5, + 1.0 + wave_quick * 0.5, ); next.l_hand.ori = @@ -59,7 +59,7 @@ impl Animation for RollAnimation { next.r_hand.offset = Vec3::new( 5.5 + wave * 0.5, -2.0 + wave_quick_cos * 2.5, - 8.0 + wave_quick * 3.0, + 1.0 + wave_quick * 3.0, ); next.r_hand.ori = Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(wave * 0.3); @@ -95,14 +95,6 @@ impl Animation for RollAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.left_equip.ori = Quaternion::rotation_x(0.0);; - next.left_equip.scale = Vec3::one() * 0.0; - - next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.right_equip.ori = Quaternion::rotation_x(0.0);; - next.right_equip.scale = Vec3::one() * 0.0; - next.torso.offset = Vec3::new(0.0, -2.2, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(wave_slow * 6.0); diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index 211ff9b9b6..b034e0897b 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -63,7 +63,7 @@ impl Animation for RunAnimation { next.l_hand.offset = Vec3::new( -7.5 + wave_cos_dub * 1.0, 2.0 + wave_cos * 5.0, - 7.0 - wave * 1.5, + 0.0 - wave * 1.5, ); next.l_hand.ori = Quaternion::rotation_x(wave_cos * 0.8); next.l_hand.scale = Vec3::one(); @@ -71,7 +71,7 @@ impl Animation for RunAnimation { next.r_hand.offset = Vec3::new( 7.5 - wave_cos_dub * 1.0, 2.0 - wave_cos * 5.0, - 7.0 + wave * 1.5, + 0.0 + wave * 1.5, ); next.r_hand.ori = Quaternion::rotation_x(wave_cos * -0.8); next.r_hand.scale = Vec3::one(); @@ -105,14 +105,6 @@ impl Animation for RunAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.left_equip.ori = Quaternion::rotation_x(0.0);; - next.left_equip.scale = Vec3::one() * 0.0; - - next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; - next.right_equip.ori = Quaternion::rotation_x(0.0);; - next.right_equip.scale = Vec3::one() * 0.0; - next.torso.offset = Vec3::new(0.0, -0.2 + wave * -0.08, 0.4 + wave_cos_dub * 0.11) * skeleton_attr.scaler; next.torso.ori = diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index 95f7af76c8..107fedc212 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -107,7 +107,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { neck_height: match (body.race, body.body_type) { (Orc, Male) => -2.0, (Orc, Female) => -2.0, - (Human, Male) => 6.0, + (Human, Male) => 0.0, (Human, Female) => -2.0, (Elf, Male) => 0.75, (Elf, Female) => -1.25, diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 8bd8465597..f8d794ce71 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -61,12 +61,12 @@ impl FigureModelCache { Some(Self::load_right_hand(body.hand)), Some(Self::load_left_foot(body.foot)), Some(Self::load_right_foot(body.foot)), - Some(Self::load_weapon(Weapon::Axe)), // TODO: Inventory + Some(Self::load_weapon(Weapon::Sword)), // TODO: Inventory Some(Self::load_left_shoulder(body.shoulder)), Some(Self::load_right_shoulder(body.shoulder)), Some(Self::load_draw()), - Some(Self::load_left_equip(Weapon::Axe)), // TODO: Inventory - Some(Self::load_right_equip(body.hand)), + None, + None, None, None, ], @@ -154,7 +154,7 @@ impl FigureModelCache { let (name, offset) = match (race, body_type) { (Human, Male) => ( "figure/head/head_human_male.vox", - Vec3::new(-7.0, -5.5, -9.25), + Vec3::new(-7.0, -5.5, -2.25), ), (Human, Female) => ( "figure/head/head_human_female.vox", @@ -340,28 +340,14 @@ impl FigureModelCache { Self::load_mesh("object/glider.vox", Vec3::new(-26.0, -26.0, -5.0)) } - fn load_left_equip(weapon: Weapon) -> Mesh { - let (name, offset) = match weapon { - Weapon::Sword => ("weapon/sword/rusty_2h.vox", Vec3::new(-1.5, -6.5, -4.0)), - Weapon::Hammer => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)), - Weapon::Axe => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -4.0)), - Weapon::Sword => ("weapon/sword/wood_2h.vox", Vec3::new(-1.5, -6.5, -4.0)), - Weapon::Daggers => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)), - Weapon::SwordShield => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)), - Weapon::Bow => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)), - Weapon::Staff => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)), - }; - Self::load_mesh(name, offset) - } - - fn load_right_equip(hand: humanoid::Hand) -> Mesh { - Self::load_mesh( - match hand { - humanoid::Hand::Default => "figure/body/hand.vox", - }, - Vec3::new(-2.0, -2.5, -5.0), - ) - } + //fn load_right_equip(hand: humanoid::Hand) -> Mesh { + // Self::load_mesh( + // match hand { + // humanoid::Hand::Default => "figure/body/hand.vox", + // }, + // Vec3::new(-2.0, -2.5, -5.0), + // ) + //} ///////// fn load_pig_head(head: quadruped::Head) -> Mesh { @@ -595,6 +581,7 @@ impl FigureMgr { }) .unwrap_or(Rgba::broadcast(1.0)); +<<<<<<< HEAD let skeleton_attr = &self .model_cache .get_or_create_model(renderer, *body, tick) @@ -626,34 +613,38 @@ impl FigureMgr { animation_info.time, skeleton_attr, ), - comp::Animation::Attack => { - anim::character::AttackAnimation::update_skeleton( + comp::Animation::Attack => anim::character::AttackAnimation::update_skeleton( state.skeleton_mut(), time, animation_info.time, skeleton_attr, ) } + comp::Animation::Cjump => anim::character::CjumpAnimation::update_skeleton( + state.skeleton_mut(), + time, + animation_info.time, + skeleton_attr, + ), comp::Animation::Roll => anim::character::RollAnimation::update_skeleton( - state.skeleton_mut(), - time, - animation_info.time, - skeleton_attr, + state.skeleton_mut(), + time, + animation_info.time, + skeleton_attr, ), comp::Animation::Crun => anim::character::CrunAnimation::update_skeleton( - state.skeleton_mut(), - (vel.0.magnitude(), time), - animation_info.time, - skeleton_attr, + state.skeleton_mut(), + (vel.0.magnitude(), time), + animation_info.time, + skeleton_attr, ), comp::Animation::Cidle => anim::character::CidleAnimation::update_skeleton( - state.skeleton_mut(), - time, - animation_info.time, - skeleton_attr, + state.skeleton_mut(), + time, + animation_info.time, + skeleton_attr, ), - comp::Animation::Gliding => { - anim::character::GlidingAnimation::update_skeleton( + comp::Animation::Gliding => anim::character::GlidingAnimation::update_skeleton( state.skeleton_mut(), (vel.0.magnitude(), time), animation_info.time,