From 78d7cfd89dd3e1beb8ea3319054e6dd985bfe980 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Fri, 19 Apr 2019 20:20:01 -0400 Subject: [PATCH] animation adjustments Former-commit-id: d396ddadf4293212f9f6f7142de0d8a519e127d6 --- voxygen/src/anim/character/idle.rs | 45 +++++++++++++++++++----------- voxygen/src/anim/character/run.rs | 39 ++++++++++++++------------ voxygen/src/scene/figure.rs | 20 ++++++------- 3 files changed, 60 insertions(+), 44 deletions(-) diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index 9bada97c00..b4bbe69b0f 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -23,28 +23,41 @@ impl Animation for IdleAnimation { time: f64, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - next.head.offset = Vec3::unit_z() * 13.0 / SCALE; - next.head.ori = Quaternion::rotation_z(0.0); - next.chest.offset = Vec3::unit_z() * 9.0 / SCALE; - next.chest.ori = Quaternion::rotation_z(0.0); + let wave = (time as f32 * 12.0).sin(); + let wavecos = (time as f32 * 12.0).cos(); + let wave_slow = (time as f32 * 6.0 + PI).sin(); + let wave_slower = (time as f32 * 2.0 + PI).sin(); + let wavecos_slower = (time as f32 * 2.0 + PI).cos(); + let waveultra_slow = (time as f32 * 1.0 + PI).sin(); + let waveultracos_slow = (time as f32 * 1.0 + PI).cos(); + let wavecos_slow = (time as f32 * 6.0 + PI).cos(); + let wave_dip = (wave_slow.abs() - 0.5).abs(); - next.belt.offset = Vec3::unit_z() * 7.0 / SCALE; - next.belt.ori = Quaternion::rotation_z(0.0); + next.head.offset = Vec3::new(0.0, 0.0, 12.0 + waveultra_slow * 0.4) / SCALE; + next.head.ori = Quaternion::rotation_y(waveultra_slow * 0.05); - next.shorts.offset = Vec3::unit_z() * 4.0 / SCALE; - next.shorts.ori = Quaternion::rotation_z(0.0); + next.chest.offset = Vec3::new(0.0, 0.0, 8.0 + waveultra_slow * 0.4) / SCALE; + next.chest.ori = Quaternion::rotation_y(0.0); - next.l_hand.offset = Vec3::new(-8.0, 0.0, 9.0) / SCALE; - next.r_hand.offset = Vec3::new(8.0, 0.0, 9.0 ) / SCALE; + next.belt.offset = Vec3::new(0.0, 0.0, 6.0 + waveultra_slow * 0.4) / SCALE; + next.belt.ori = Quaternion::rotation_y(0.0); - next.l_foot.offset = Vec3::new(-3.5, 0.0, 3.0) / SCALE; - next.l_foot.ori = Quaternion::rotation_x(0.0); - next.r_foot.offset = Vec3::new(3.5, 0.0, 3.0) / SCALE; - next.r_foot.ori = Quaternion::rotation_x(0.0); + next.shorts.offset = Vec3::new(0.0, 0.0, 3.0 + waveultra_slow * 0.4) / SCALE; + next.shorts.ori = Quaternion::rotation_y(0.0); - next.back.offset = Vec3::new(-9.0, 5.0, 18.0); - next.back.ori = Quaternion::rotation_y(2.5); + next.l_hand.offset = Vec3::new(0.0 + waveultracos_slow * 0.3, 7.5, 11.0 + waveultra_slow * 1.1) / SCALE; + next.l_hand.ori = Quaternion::rotation_y(0.0 + waveultra_slow * 0.06); + next.r_hand.offset = Vec3::new(0.0 + waveultracos_slow * 0.3 , - 7.5, 11.0 + waveultra_slow * 1.1) / SCALE; + next.r_hand.ori = Quaternion::rotation_y(0.0 + waveultra_slow * 0.06); + + next.l_foot.offset = Vec3::new(2.5, 3.4, 6.0) / SCALE; + next.l_foot.ori = Quaternion::rotation_y(0.04 + waveultra_slow * 0.04); + next.r_foot.offset = Vec3::new(2.5, -3.4, 6.0) / SCALE; + next.r_foot.ori = Quaternion::rotation_y(0.04 + waveultra_slow * 0.04); + + next.back.offset = Vec3::new(-6.5, 16.0, 15.0); + next.back.ori = Quaternion::rotation_x(2.5); next.back.scale = Vec3::one(); next diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index 258b610205..5b06e64d1a 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -23,34 +23,37 @@ impl Animation for RunAnimation { ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let wave = (time as f32 * 12.0).sin(); - let wavecos = (time as f32 * 12.0).cos(); - let wave_slow = (time as f32 * 6.0 + PI).sin(); - let wavecos_slow = (time as f32 * 6.0 + PI).cos(); + let wave = (time as f32 * 14.0).sin(); + let fuzzwave = (time as f32 * 12.0).sin(); + let wavecos = (time as f32 * 14.0).cos(); + let wave_slow = (time as f32 * 8.0 + PI).sin(); + let waveultra_slow = (time as f32 * 0.5 + PI).sin(); + let wavecos_slow = (time as f32 * 8.0 + PI).cos(); let wave_dip = (wave_slow.abs() - 0.5).abs(); - next.head.offset = Vec3::unit_z() * 13.0 / SCALE; - next.head.ori = Quaternion::rotation_z(wave * 0.3); + next.head.offset = Vec3::unit_z() * (12.0 + fuzzwave *0.4)/ SCALE; - next.chest.offset = Vec3::unit_z() * 9.0 / SCALE; - next.chest.ori = Quaternion::rotation_z(wave * 0.3); + next.chest.offset = Vec3::unit_z() * (8.0 + fuzzwave * 0.3) / SCALE; + next.chest.ori = Quaternion::rotation_z(wave * 0.2); - next.belt.offset = Vec3::unit_z() * 7.0 / SCALE; + next.belt.offset = Vec3::unit_z() * (6.0 + fuzzwave * 0.3)/ SCALE; next.belt.ori = Quaternion::rotation_z(wave * 0.2); - next.shorts.offset = Vec3::unit_z() * 4.0 / SCALE; + next.shorts.offset = Vec3::unit_z() * (3.0 + fuzzwave * 0.3) / SCALE; next.shorts.ori = Quaternion::rotation_z(wave * 0.1); - next.l_hand.offset = Vec3::new(-6.0 - wave_dip * 6.0, wave * 5.0, 11.0 - wave_dip * 6.0) / SCALE; - next.r_hand.offset = Vec3::new(6.0 + wave_dip * 6.0, -wave * 5.0, 11.0 - wave_dip * 6.0) / SCALE; + next.l_hand.offset = Vec3::new(0.0 - wavecos * 1.0, 7.5, 11.0 - wave * 1.0) / SCALE; + next.l_hand.ori = Quaternion::rotation_y(wave * -1.8); + next.r_hand.offset = Vec3::new(0.0 + wavecos * 1.0, -7.5, 11.0 + wave * 1.0) / SCALE; + next.r_hand.ori = Quaternion::rotation_y(wave * 1.8); - next.l_foot.offset = Vec3::new(-3.5, 1.0 - wave * 8.0, 3.5 - wave_dip * 4.0) / SCALE; - next.l_foot.ori = Quaternion::rotation_x(-wave + 1.0); - next.r_foot.offset = Vec3::new(3.5, 1.0 + wave * 8.0, 3.5 - wave_dip * 4.0) / SCALE; - next.r_foot.ori = Quaternion::rotation_x(wave + 1.0); + next.l_foot.offset = Vec3::new(2.5 - wavecos * 4.0, 3.4, 6.0 + wave * 2.5) / SCALE; + next.l_foot.ori = Quaternion::rotation_y(wave * -1.0); + next.r_foot.offset = Vec3::new(2.5 + wavecos * 4.0, -3.4, 6.0 - wave * 2.5) / SCALE; + next.r_foot.ori = Quaternion::rotation_y(wave * 1.0); - next.back.offset = Vec3::new(-9.0, 5.0, 18.0); - next.back.ori = Quaternion::rotation_y(2.5); + next.back.offset = Vec3::new(-6.0, 16.0, 15.0); + next.back.ori = Quaternion::rotation_x(2.5); next.back.scale = Vec3::one(); next diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 849e865686..3a0c0a726e 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -53,15 +53,15 @@ impl Figures { } let bone_meshes = [ - Some(load_segment("head.vox").generate_mesh(Vec3::new(-7.0, -6.5, -6.0))), - Some(load_segment("chest.vox").generate_mesh(Vec3::new(-6.0, -3.0, 0.0))), - Some(load_segment("belt.vox").generate_mesh(Vec3::new(-5.0, -3.0, 0.0))), - Some(load_segment("pants.vox").generate_mesh(Vec3::new(-5.0, -3.0, 0.0))), - Some(load_segment("hand.vox").generate_mesh(Vec3::new(-2.0, -2.0, -1.0))), - Some(load_segment("hand.vox").generate_mesh(Vec3::new(-2.0, -2.0, -1.0))), - Some(load_segment("foot.vox").generate_mesh(Vec3::new(-2.5, -3.0, -2.0))), - Some(load_segment("foot.vox").generate_mesh(Vec3::new(-2.5, -3.0, -2.0))), - Some(load_segment("sword.vox").generate_mesh(Vec3::new(-6.5, -1.0, 0.0))), + Some(load_segment("head.vox").generate_mesh(Vec3::new(-7.5, -7.0, -6.0))), + Some(load_segment("chest.vox").generate_mesh(Vec3::new(-3.0, -6.0, 0.0))), + Some(load_segment("belt.vox").generate_mesh(Vec3::new(-3.0, -5.0, 0.0))), + Some(load_segment("pants.vox").generate_mesh(Vec3::new(-3.0, -5.0, 0.0))), + Some(load_segment("hand.vox").generate_mesh(Vec3::new(0.0, -2.0, -6.0))), + Some(load_segment("hand.vox").generate_mesh(Vec3::new(0.0, -2.0, -6.0))), + Some(load_segment("foot.vox").generate_mesh(Vec3::new(-4.0, -2.5, -6.0))), + Some(load_segment("foot.vox").generate_mesh(Vec3::new(-4.0, -2.5, -6.0))), + Some(load_segment("sword.vox").generate_mesh(Vec3::new(0.0, -0.0, 0.0))), None, None, None, @@ -144,7 +144,7 @@ impl FigureState { let mat = Mat4::::identity() * Mat4::translation_3d(pos) * - Mat4::rotation_z(dir.y.atan2(dir.x) + f32::consts::PI / 2.0); + Mat4::rotation_z(dir.y.atan2(dir.x));// + f32//::consts)::PI / 2.0); let locals = FigureLocals::new(mat); renderer.update_consts(&mut self.locals, &[locals]).unwrap();