Merge branch 'master' into 'master'

animation tweaks

See merge request veloren/veloren!57

Former-commit-id: 070d47b4b3488a447523769169811cf25fb7a04b
This commit is contained in:
Joshua Barretto 2019-04-20 23:43:34 +00:00
commit 0dca245a53
20 changed files with 62 additions and 44 deletions

@ -1 +1 @@
Subproject commit e3083ec8e8e634af8c9daed00ea82435da195979
Subproject commit 0a176c408946f081850132623a6730d9d2b1e7ed

View File

@ -23,28 +23,39 @@ 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 wavecos_slow = (time as f32 * 6.0 + PI).cos();
let waveultra_slow = (time as f32 * 1.0 + PI).sin();
let waveultracos_slow = (time as f32 * 1.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

View File

@ -23,34 +23,40 @@ impl Animation for RunAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave = (time as f32 * 12.0).sin();
let wave_slow = (time as f32 * 6.0 + PI).sin();
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 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 *1.0)/ SCALE;
next.chest.offset = Vec3::unit_z() * 9.0 / SCALE;
next.chest.offset = Vec3::unit_z() * (8.0 + fuzzwave * 0.8) / SCALE;
next.chest.ori = Quaternion::rotation_z(wave * 0.3);
next.belt.offset = Vec3::unit_z() * 7.0 / SCALE;
next.belt.ori = Quaternion::rotation_z(wave * 0.2);
next.belt.offset = Vec3::unit_z() * (6.0 + fuzzwave * 0.8) / SCALE;
next.belt.ori = Quaternion::rotation_z(wave * 0.3);
next.shorts.offset = Vec3::unit_z() * 4.0 / SCALE;
next.shorts.ori = Quaternion::rotation_z(wave * 0.1);
next.shorts.offset = Vec3::unit_z() * (3.0 + fuzzwave * 0.8) / SCALE;
next.shorts.ori = Quaternion::rotation_z(wave * 0.2);
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.9) / 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.9) / SCALE;
next.back.offset = Vec3::new(-9.0, 5.0, 18.0);
next.back.ori = Quaternion::rotation_y(2.5);
next.r_foot.ori = Quaternion::rotation_y(wave * 1.0);
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
}
}

View File

@ -53,15 +53,16 @@ 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(-3.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 +145,7 @@ impl<S: Skeleton> FigureState<S> {
let mat =
Mat4::<f32>::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();

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.