From fa60e231d04325e26bc307d9718dd0aadbc7fc5d Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sat, 29 Jun 2019 22:13:34 -0400 Subject: [PATCH 1/8] combat run/jump/idle animation states --- .../voxel/figure/head/head_danari_female.vox | 2 +- common/src/comp/animation.rs | 1 + common/src/comp/inputs.rs | 19 ++++ common/src/comp/mod.rs | 2 +- common/src/state.rs | 1 + common/src/sys/animation.rs | 1 + common/src/sys/combat.rs | 5 +- voxygen/src/anim/character/attack.rs | 52 ++++------ voxygen/src/anim/character/cidle.rs | 98 +++++++++++-------- voxygen/src/anim/character/cjump.rs | 98 +++++++++++++++++++ voxygen/src/anim/character/crun.rs | 68 ++++++++----- voxygen/src/anim/character/gliding.rs | 8 -- voxygen/src/anim/character/idle.rs | 12 +-- voxygen/src/anim/character/jump.rs | 12 +-- voxygen/src/anim/character/mod.rs | 17 ++-- voxygen/src/anim/character/roll.rs | 12 +-- voxygen/src/anim/character/run.rs | 12 +-- voxygen/src/anim/mod.rs | 2 +- voxygen/src/scene/figure.rs | 75 +++++++------- 19 files changed, 291 insertions(+), 206 deletions(-) create mode 100644 voxygen/src/anim/character/cjump.rs 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, From e5bdace124b6412e1499fd9914ba9d6d590cd110 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 30 Jun 2019 13:59:29 -0400 Subject: [PATCH 2/8] head position fixes --- voxygen/src/anim/mod.rs | 8 ++++---- voxygen/src/scene/figure.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index 107fedc212..8fe0a4f56d 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -109,7 +109,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { (Orc, Female) => -2.0, (Human, Male) => 0.0, (Human, Female) => -2.0, - (Elf, Male) => 0.75, + (Elf, Male) => -0.5, (Elf, Female) => -1.25, (Dwarf, Male) => -0.0, (Dwarf, Female) => -1.0, @@ -124,7 +124,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { (Orc, Female) => -1.0, (Human, Male) => 0.0, (Human, Female) => -1.0, - (Elf, Male) => 1.75, + (Elf, Male) => 1.25, (Elf, Female) => -0.5, (Dwarf, Male) => 2.0, (Dwarf, Female) => 0.0, @@ -139,8 +139,8 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { (Orc, Female) => 0.0, (Human, Male) => 0.0, (Human, Female) => 0.0, - (Elf, Male) => -1.0, - (Elf, Female) => 0.25, + (Elf, Male) => 0.0, + (Elf, Female) => -0.25, (Dwarf, Male) => 0.0, (Dwarf, Female) => 0.0, (Undead, Male) => -0.5, diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index f8d794ce71..27873a1988 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -162,7 +162,7 @@ impl FigureModelCache { ), (Elf, Male) => ( "figure/head/head_elf_male.vox", - Vec3::new(-7.0, -6.5, -3.75), + Vec3::new(-8.0, -5.0, -2.25), ), (Elf, Female) => ( "figure/head/head_elf_female.vox", From b42c6dba613b4ed9cd140baf1cccccc8d7180daf Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 30 Jun 2019 17:57:19 -0400 Subject: [PATCH 3/8] rebase --- common/src/sys/animation.rs | 2 -- voxygen/src/scene/figure.rs | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 53234f0773..5f429512b0 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -20,8 +20,6 @@ impl<'a> System<'a> for Sys { warn!("{}", message); 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/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 27873a1988..dd21b3b548 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -581,7 +581,6 @@ impl FigureMgr { }) .unwrap_or(Rgba::broadcast(1.0)); -<<<<<<< HEAD let skeleton_attr = &self .model_cache .get_or_create_model(renderer, *body, tick) @@ -613,7 +612,8 @@ 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, @@ -644,7 +644,8 @@ impl FigureMgr { 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, From 4e19e46a2442b4d89c353b30b39f23a7242c819f Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 30 Jun 2019 18:52:25 -0400 Subject: [PATCH 4/8] glider animation fix --- common/src/comp/action_state.rs | 2 ++ common/src/comp/mod.rs | 2 +- common/src/sys/action_state.rs | 7 +++++- common/src/sys/animation.rs | 32 ++++++++++++++++++--------- common/src/sys/combat.rs | 2 +- voxygen/src/anim/character/cidle.rs | 2 -- voxygen/src/anim/character/cjump.rs | 12 ++-------- voxygen/src/anim/character/crun.rs | 18 +++------------ voxygen/src/anim/character/gliding.rs | 15 +++++++++---- voxygen/src/anim/character/mod.rs | 5 ++--- voxygen/src/anim/mod.rs | 2 +- voxygen/src/scene/figure.rs | 32 +++++++++++++-------------- 12 files changed, 66 insertions(+), 65 deletions(-) diff --git a/common/src/comp/action_state.rs b/common/src/comp/action_state.rs index 7296e1031f..821fee92b7 100644 --- a/common/src/comp/action_state.rs +++ b/common/src/comp/action_state.rs @@ -7,6 +7,7 @@ pub struct ActionState { pub attacking: bool, pub rolling: bool, pub gliding: bool, + pub wielding: bool, } impl Default for ActionState { @@ -17,6 +18,7 @@ impl Default for ActionState { attacking: false, rolling: false, gliding: false, + wielding: false, } } } diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index 913a9d4664..2ec6fdb8aa 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, Wielding, OnGround, Respawning, Rolling}; +pub use inputs::{Attacking, Gliding, Jumping, MoveDir, OnGround, Respawning, Rolling, Wielding}; pub use inventory::{item, Inventory}; pub use phys::{ForceUpdate, Ori, Pos, Vel}; pub use player::Player; diff --git a/common/src/sys/action_state.rs b/common/src/sys/action_state.rs index 08c1a3d514..aa2f27e0d0 100644 --- a/common/src/sys/action_state.rs +++ b/common/src/sys/action_state.rs @@ -1,7 +1,7 @@ use crate::{ comp::{ ActionState, Animation, AnimationInfo, Attacking, Controller, ForceUpdate, Gliding, - Jumping, OnGround, Ori, Pos, Rolling, Vel, + Jumping, OnGround, Ori, Pos, Rolling, Vel, Wielding, }, state::DeltaTime, sys::phys::MOVEMENT_THRESHOLD_VEL, @@ -20,6 +20,7 @@ impl<'a> System<'a> for Sys { ReadStorage<'a, Jumping>, ReadStorage<'a, Gliding>, ReadStorage<'a, Attacking>, + ReadStorage<'a, Wielding>, ReadStorage<'a, Rolling>, WriteStorage<'a, ActionState>, ); @@ -35,6 +36,7 @@ impl<'a> System<'a> for Sys { jumpings, glidings, attackings, + wieldings, rollings, mut action_states, ): Self::SystemData, @@ -47,6 +49,7 @@ impl<'a> System<'a> for Sys { jumping, gliding, attacking, + wielding, rolling, mut action_state, ) in ( @@ -57,6 +60,7 @@ impl<'a> System<'a> for Sys { jumpings.maybe(), glidings.maybe(), attackings.maybe(), + wieldings.maybe(), rollings.maybe(), &mut action_states, ) @@ -66,6 +70,7 @@ impl<'a> System<'a> for Sys { on_ground: on_ground.is_some(), moving: vel.0.magnitude_squared() > MOVEMENT_THRESHOLD_VEL.powf(2.0), attacking: attacking.is_some(), + wielding: wielding.is_some(), rolling: rolling.is_some(), gliding: gliding.is_some(), }; diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 5f429512b0..00f811a389 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -20,17 +20,27 @@ impl<'a> System<'a> for Sys { warn!("{}", message); Animation::Idle } - 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"), - (_, _, _, true, true) => impossible_animation("Roll while gliding"), - (_, false, _, _, true) => impossible_animation("Roll without moving"), - (_, true, false, false, true) => Animation::Roll, - (true, false, false, false, false) => Animation::Idle, - (true, true, false, false, false) => Animation::Run, - (false, _, false, false, false) => Animation::Jump, - (_, _, false, true, false) => Animation::Gliding, - (_, _, true, false, false) => Animation::Attack, + let animation = match ( + a.on_ground, + a.moving, + a.attacking, + a.gliding, + a.rolling, + a.wielding, + ) { + (_, _, true, true, _, _) => impossible_animation("Attack while gliding"), + (_, _, true, _, true, _) => impossible_animation("Roll while attacking"), + (_, _, _, true, true, _) => impossible_animation("Roll while gliding"), + (_, false, _, _, true, _) => impossible_animation("Roll without moving"), + (_, true, false, false, true, _) => Animation::Roll, + (true, false, false, false, false, false) => Animation::Idle, + (true, true, false, false, false, false) => Animation::Run, + (false, _, false, false, false, false) => Animation::Jump, + (true, false, false, false, false, true) => Animation::Cidle, + (true, true, false, false, false, true) => Animation::Crun, + (false, _, false, false, false, true) => Animation::Cjump, + (_, _, false, true, false, _) => Animation::Gliding, + (_, _, true, false, false, _) => Animation::Attack, }; let new_time = animation_infos diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 0861fa30f3..46bce443ae 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -1,6 +1,6 @@ use crate::{ comp::{ - Attacking, Wielding, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel}, + Attacking, HealthSource, Stats, Wielding, {ForceUpdate, Ori, Pos, Vel}, }, state::{DeltaTime, Uid}, }; diff --git a/voxygen/src/anim/character/cidle.rs b/voxygen/src/anim/character/cidle.rs index 33c84f3d4d..139109518e 100644 --- a/voxygen/src/anim/character/cidle.rs +++ b/voxygen/src/anim/character/cidle.rs @@ -29,8 +29,6 @@ impl Animation for CidleAnimation { 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 / 1.5) .floor() diff --git a/voxygen/src/anim/character/cjump.rs b/voxygen/src/anim/character/cjump.rs index 2bfafd30cc..a585e923a6 100644 --- a/voxygen/src/anim/character/cjump.rs +++ b/voxygen/src/anim/character/cjump.rs @@ -43,19 +43,11 @@ impl Animation for CjumpAnimation { 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.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.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(); diff --git a/voxygen/src/anim/character/crun.rs b/voxygen/src/anim/character/crun.rs index 96dd7d4166..72d5788c27 100644 --- a/voxygen/src/anim/character/crun.rs +++ b/voxygen/src/anim/character/crun.rs @@ -60,19 +60,11 @@ impl Animation for CrunAnimation { next.shorts.ori = Quaternion::rotation_z(wave * 0.6); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new( - -6.0, - 4.0, - 0.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( - -6.0, - 3.0, - -2.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(); @@ -84,11 +76,7 @@ impl Animation for CrunAnimation { next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.0, - 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); diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 3df382b709..a13e41a469 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -60,12 +60,19 @@ impl Animation for GlidingAnimation { next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-10.0, -5.0 + wave_very_slow * 0.1, 8.5); - next.l_hand.ori = - Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.1) * skeleton_attr.scaler; + next.l_hand.offset = Vec3::new( + -9.5 + wave_very_slow_cos * -1.5, + -7.0 + wave_very_slow_cos * 1.5, + 9.0, + ); + next.l_hand.ori = Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.1); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(10.0, -5.0 + wave_very_slow * 0.1, 8.5); + next.r_hand.offset = Vec3::new( + 9.5 + wave_very_slow_cos * -1.5, + -7.0 + wave_very_slow_cos * -1.5, + 9.0, + ); next.r_hand.ori = Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.10); next.r_hand.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 3a4e6c3055..65d15ec481 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -1,7 +1,7 @@ pub mod attack; pub mod cidle; -pub mod crun; pub mod cjump; +pub mod crun; pub mod gliding; pub mod idle; pub mod jump; @@ -11,8 +11,8 @@ pub mod run; // Reexports pub use self::attack::AttackAnimation; pub use self::cidle::CidleAnimation; -pub use self::crun::CrunAnimation; pub use self::cjump::CjumpAnimation; +pub use self::crun::CrunAnimation; pub use self::gliding::GlidingAnimation; pub use self::idle::IdleAnimation; pub use self::jump::JumpAnimation; @@ -85,7 +85,6 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), - ] } diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index 8fe0a4f56d..227dac1da8 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) => 0.0, + (Human, Male) => -0.5, (Human, Female) => -2.0, (Elf, Male) => -0.5, (Elf, Female) => -1.25, diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index dd21b3b548..108b5cf19a 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -621,28 +621,28 @@ impl FigureMgr { ) } comp::Animation::Cjump => anim::character::CjumpAnimation::update_skeleton( - state.skeleton_mut(), - time, - animation_info.time, - skeleton_attr, + 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( From 2ce5c5881e2d70d538c49be8b477dccfa55f5a9b Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sat, 29 Jun 2019 22:13:34 -0400 Subject: [PATCH 5/8] combat run/jump/idle animation states --- .../voxel/figure/head/head_danari_female.vox | 2 +- common/src/comp/animation.rs | 1 + common/src/comp/inputs.rs | 19 ++++ common/src/comp/mod.rs | 2 +- common/src/state.rs | 1 + common/src/sys/animation.rs | 1 + common/src/sys/combat.rs | 5 +- voxygen/src/anim/character/attack.rs | 52 ++++------ voxygen/src/anim/character/cidle.rs | 98 +++++++++++-------- voxygen/src/anim/character/cjump.rs | 98 +++++++++++++++++++ voxygen/src/anim/character/crun.rs | 68 ++++++++----- voxygen/src/anim/character/gliding.rs | 8 -- voxygen/src/anim/character/idle.rs | 12 +-- voxygen/src/anim/character/jump.rs | 12 +-- voxygen/src/anim/character/mod.rs | 17 ++-- voxygen/src/anim/character/roll.rs | 12 +-- voxygen/src/anim/character/run.rs | 12 +-- voxygen/src/anim/mod.rs | 2 +- voxygen/src/scene/figure.rs | 75 +++++++------- 19 files changed, 291 insertions(+), 206 deletions(-) create mode 100644 voxygen/src/anim/character/cjump.rs 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, From aea0d0002b71a3e240507fc90da7bba287c33e49 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 30 Jun 2019 13:59:29 -0400 Subject: [PATCH 6/8] head position fixes --- voxygen/src/anim/mod.rs | 8 ++++---- voxygen/src/scene/figure.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index 107fedc212..8fe0a4f56d 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -109,7 +109,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { (Orc, Female) => -2.0, (Human, Male) => 0.0, (Human, Female) => -2.0, - (Elf, Male) => 0.75, + (Elf, Male) => -0.5, (Elf, Female) => -1.25, (Dwarf, Male) => -0.0, (Dwarf, Female) => -1.0, @@ -124,7 +124,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { (Orc, Female) => -1.0, (Human, Male) => 0.0, (Human, Female) => -1.0, - (Elf, Male) => 1.75, + (Elf, Male) => 1.25, (Elf, Female) => -0.5, (Dwarf, Male) => 2.0, (Dwarf, Female) => 0.0, @@ -139,8 +139,8 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { (Orc, Female) => 0.0, (Human, Male) => 0.0, (Human, Female) => 0.0, - (Elf, Male) => -1.0, - (Elf, Female) => 0.25, + (Elf, Male) => 0.0, + (Elf, Female) => -0.25, (Dwarf, Male) => 0.0, (Dwarf, Female) => 0.0, (Undead, Male) => -0.5, diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index f8d794ce71..27873a1988 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -162,7 +162,7 @@ impl FigureModelCache { ), (Elf, Male) => ( "figure/head/head_elf_male.vox", - Vec3::new(-7.0, -6.5, -3.75), + Vec3::new(-8.0, -5.0, -2.25), ), (Elf, Female) => ( "figure/head/head_elf_female.vox", From e9bbe0e80000e0f117ebe5afbd4c48794959b3e3 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 30 Jun 2019 17:57:19 -0400 Subject: [PATCH 7/8] rebase --- common/src/sys/animation.rs | 2 -- voxygen/src/scene/figure.rs | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 53234f0773..5f429512b0 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -20,8 +20,6 @@ impl<'a> System<'a> for Sys { warn!("{}", message); 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/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 27873a1988..dd21b3b548 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -581,7 +581,6 @@ impl FigureMgr { }) .unwrap_or(Rgba::broadcast(1.0)); -<<<<<<< HEAD let skeleton_attr = &self .model_cache .get_or_create_model(renderer, *body, tick) @@ -613,7 +612,8 @@ 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, @@ -644,7 +644,8 @@ impl FigureMgr { 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, From cc548eb669f6100c98333f5a4e0cc85228c36916 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 30 Jun 2019 18:52:25 -0400 Subject: [PATCH 8/8] glider animation fix --- common/src/comp/action_state.rs | 2 ++ common/src/comp/mod.rs | 2 +- common/src/sys/action_state.rs | 7 +++++- common/src/sys/animation.rs | 32 ++++++++++++++++++--------- common/src/sys/combat.rs | 2 +- voxygen/src/anim/character/cidle.rs | 2 -- voxygen/src/anim/character/cjump.rs | 12 ++-------- voxygen/src/anim/character/crun.rs | 18 +++------------ voxygen/src/anim/character/gliding.rs | 15 +++++++++---- voxygen/src/anim/character/mod.rs | 5 ++--- voxygen/src/anim/mod.rs | 2 +- voxygen/src/scene/figure.rs | 32 +++++++++++++-------------- 12 files changed, 66 insertions(+), 65 deletions(-) diff --git a/common/src/comp/action_state.rs b/common/src/comp/action_state.rs index 7296e1031f..821fee92b7 100644 --- a/common/src/comp/action_state.rs +++ b/common/src/comp/action_state.rs @@ -7,6 +7,7 @@ pub struct ActionState { pub attacking: bool, pub rolling: bool, pub gliding: bool, + pub wielding: bool, } impl Default for ActionState { @@ -17,6 +18,7 @@ impl Default for ActionState { attacking: false, rolling: false, gliding: false, + wielding: false, } } } diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index 913a9d4664..2ec6fdb8aa 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, Wielding, OnGround, Respawning, Rolling}; +pub use inputs::{Attacking, Gliding, Jumping, MoveDir, OnGround, Respawning, Rolling, Wielding}; pub use inventory::{item, Inventory}; pub use phys::{ForceUpdate, Ori, Pos, Vel}; pub use player::Player; diff --git a/common/src/sys/action_state.rs b/common/src/sys/action_state.rs index 08c1a3d514..aa2f27e0d0 100644 --- a/common/src/sys/action_state.rs +++ b/common/src/sys/action_state.rs @@ -1,7 +1,7 @@ use crate::{ comp::{ ActionState, Animation, AnimationInfo, Attacking, Controller, ForceUpdate, Gliding, - Jumping, OnGround, Ori, Pos, Rolling, Vel, + Jumping, OnGround, Ori, Pos, Rolling, Vel, Wielding, }, state::DeltaTime, sys::phys::MOVEMENT_THRESHOLD_VEL, @@ -20,6 +20,7 @@ impl<'a> System<'a> for Sys { ReadStorage<'a, Jumping>, ReadStorage<'a, Gliding>, ReadStorage<'a, Attacking>, + ReadStorage<'a, Wielding>, ReadStorage<'a, Rolling>, WriteStorage<'a, ActionState>, ); @@ -35,6 +36,7 @@ impl<'a> System<'a> for Sys { jumpings, glidings, attackings, + wieldings, rollings, mut action_states, ): Self::SystemData, @@ -47,6 +49,7 @@ impl<'a> System<'a> for Sys { jumping, gliding, attacking, + wielding, rolling, mut action_state, ) in ( @@ -57,6 +60,7 @@ impl<'a> System<'a> for Sys { jumpings.maybe(), glidings.maybe(), attackings.maybe(), + wieldings.maybe(), rollings.maybe(), &mut action_states, ) @@ -66,6 +70,7 @@ impl<'a> System<'a> for Sys { on_ground: on_ground.is_some(), moving: vel.0.magnitude_squared() > MOVEMENT_THRESHOLD_VEL.powf(2.0), attacking: attacking.is_some(), + wielding: wielding.is_some(), rolling: rolling.is_some(), gliding: gliding.is_some(), }; diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 5f429512b0..00f811a389 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -20,17 +20,27 @@ impl<'a> System<'a> for Sys { warn!("{}", message); Animation::Idle } - 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"), - (_, _, _, true, true) => impossible_animation("Roll while gliding"), - (_, false, _, _, true) => impossible_animation("Roll without moving"), - (_, true, false, false, true) => Animation::Roll, - (true, false, false, false, false) => Animation::Idle, - (true, true, false, false, false) => Animation::Run, - (false, _, false, false, false) => Animation::Jump, - (_, _, false, true, false) => Animation::Gliding, - (_, _, true, false, false) => Animation::Attack, + let animation = match ( + a.on_ground, + a.moving, + a.attacking, + a.gliding, + a.rolling, + a.wielding, + ) { + (_, _, true, true, _, _) => impossible_animation("Attack while gliding"), + (_, _, true, _, true, _) => impossible_animation("Roll while attacking"), + (_, _, _, true, true, _) => impossible_animation("Roll while gliding"), + (_, false, _, _, true, _) => impossible_animation("Roll without moving"), + (_, true, false, false, true, _) => Animation::Roll, + (true, false, false, false, false, false) => Animation::Idle, + (true, true, false, false, false, false) => Animation::Run, + (false, _, false, false, false, false) => Animation::Jump, + (true, false, false, false, false, true) => Animation::Cidle, + (true, true, false, false, false, true) => Animation::Crun, + (false, _, false, false, false, true) => Animation::Cjump, + (_, _, false, true, false, _) => Animation::Gliding, + (_, _, true, false, false, _) => Animation::Attack, }; let new_time = animation_infos diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 0861fa30f3..46bce443ae 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -1,6 +1,6 @@ use crate::{ comp::{ - Attacking, Wielding, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel}, + Attacking, HealthSource, Stats, Wielding, {ForceUpdate, Ori, Pos, Vel}, }, state::{DeltaTime, Uid}, }; diff --git a/voxygen/src/anim/character/cidle.rs b/voxygen/src/anim/character/cidle.rs index 33c84f3d4d..139109518e 100644 --- a/voxygen/src/anim/character/cidle.rs +++ b/voxygen/src/anim/character/cidle.rs @@ -29,8 +29,6 @@ impl Animation for CidleAnimation { 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 / 1.5) .floor() diff --git a/voxygen/src/anim/character/cjump.rs b/voxygen/src/anim/character/cjump.rs index 2bfafd30cc..a585e923a6 100644 --- a/voxygen/src/anim/character/cjump.rs +++ b/voxygen/src/anim/character/cjump.rs @@ -43,19 +43,11 @@ impl Animation for CjumpAnimation { 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.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.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(); diff --git a/voxygen/src/anim/character/crun.rs b/voxygen/src/anim/character/crun.rs index 96dd7d4166..72d5788c27 100644 --- a/voxygen/src/anim/character/crun.rs +++ b/voxygen/src/anim/character/crun.rs @@ -60,19 +60,11 @@ impl Animation for CrunAnimation { next.shorts.ori = Quaternion::rotation_z(wave * 0.6); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new( - -6.0, - 4.0, - 0.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( - -6.0, - 3.0, - -2.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(); @@ -84,11 +76,7 @@ impl Animation for CrunAnimation { next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.0, - 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); diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 3df382b709..a13e41a469 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -60,12 +60,19 @@ impl Animation for GlidingAnimation { next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-10.0, -5.0 + wave_very_slow * 0.1, 8.5); - next.l_hand.ori = - Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.1) * skeleton_attr.scaler; + next.l_hand.offset = Vec3::new( + -9.5 + wave_very_slow_cos * -1.5, + -7.0 + wave_very_slow_cos * 1.5, + 9.0, + ); + next.l_hand.ori = Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.1); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(10.0, -5.0 + wave_very_slow * 0.1, 8.5); + next.r_hand.offset = Vec3::new( + 9.5 + wave_very_slow_cos * -1.5, + -7.0 + wave_very_slow_cos * -1.5, + 9.0, + ); next.r_hand.ori = Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.10); next.r_hand.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 3a4e6c3055..65d15ec481 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -1,7 +1,7 @@ pub mod attack; pub mod cidle; -pub mod crun; pub mod cjump; +pub mod crun; pub mod gliding; pub mod idle; pub mod jump; @@ -11,8 +11,8 @@ pub mod run; // Reexports pub use self::attack::AttackAnimation; pub use self::cidle::CidleAnimation; -pub use self::crun::CrunAnimation; pub use self::cjump::CjumpAnimation; +pub use self::crun::CrunAnimation; pub use self::gliding::GlidingAnimation; pub use self::idle::IdleAnimation; pub use self::jump::JumpAnimation; @@ -85,7 +85,6 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), - ] } diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index 8fe0a4f56d..227dac1da8 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) => 0.0, + (Human, Male) => -0.5, (Human, Female) => -2.0, (Elf, Male) => -0.5, (Elf, Female) => -1.25, diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index dd21b3b548..108b5cf19a 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -621,28 +621,28 @@ impl FigureMgr { ) } comp::Animation::Cjump => anim::character::CjumpAnimation::update_skeleton( - state.skeleton_mut(), - time, - animation_info.time, - skeleton_attr, + 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(