mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
laying groundwork for combat anims, untangling skeleton
Former-commit-id: a17189557788b09f91b720ff695767c9229fc726
This commit is contained in:
parent
726e6c1d06
commit
e4e045bda6
@ -29,7 +29,11 @@ impl Animation for AttackAnimation {
|
||||
let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos();
|
||||
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_dip = (wave_slow.abs() - 0.5).abs();
|
||||
let wave_stop = (anim_time as f32 * 3.0).min(PI / 2.0).sin();
|
||||
let wave_stop_alt = (anim_time as f32 * 28.0).min(PI / 2.0).sin();
|
||||
let wave_stop_quick = (anim_time as f32 * 8.0).min(PI / 2.0).sin();
|
||||
let peakwave = 1.0- (anim_time as f32 * 1.0).cos();
|
||||
|
||||
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 8.0)
|
||||
@ -60,21 +64,21 @@ impl Animation for AttackAnimation {
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0,
|
||||
-2.0 + wave_ultra_slow_cos * 0.15,
|
||||
11.5 + wave_ultra_slow * 0.5,
|
||||
);
|
||||
-8.0,
|
||||
4.0,
|
||||
9.0,
|
||||
) / 11.0;
|
||||
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.5);
|
||||
next.l_hand.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
9.0,
|
||||
-2.0,
|
||||
11.5,
|
||||
);
|
||||
8.0,
|
||||
4.0,
|
||||
6.5,
|
||||
) / 11.0;
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
next.r_hand.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0);
|
||||
next.l_foot.ori = Quaternion::identity();
|
||||
@ -84,8 +88,8 @@ impl Animation for AttackAnimation {
|
||||
next.r_foot.ori = Quaternion::identity();
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.weapon.ori = Quaternion::identity();
|
||||
next.weapon.offset = Vec3::new(-12.0, -2.0, 11.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5);
|
||||
@ -100,13 +104,11 @@ impl Animation for AttackAnimation {
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.l_hold.offset = Vec3::new(0.0, 0.0, 25.0);
|
||||
next.l_hold.ori = Quaternion::rotation_z(wave * 10.0);
|
||||
next.l_hold.scale = Vec3::one();
|
||||
|
||||
next.r_hold.offset = Vec3::new(2.0, 2.5, 0.0);
|
||||
next.r_hold.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_hold.scale = Vec3::one();
|
||||
next.left_equip.offset = Vec3::new(-8.0, 4.0, 10.0) / 13.0;
|
||||
next.left_equip.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.5) * Quaternion::rotation_z(1.57);
|
||||
next.left_equip.scale = Vec3::one() / 11.0;
|
||||
|
||||
|
||||
next.torso.offset = Vec3::new(-0.5, -0.2, 0.1);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
|
@ -64,20 +64,20 @@ impl Animation for GlidingAnimation {
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-8.0,
|
||||
-10.0 + wave_very_slow * 2.5,
|
||||
18.5 + wave_very_slow * 1.0,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.9 - wave_very_slow * 0.10);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
-10.0,
|
||||
6.0 - wave_very_slow * 1.50,
|
||||
15.0 + wave_very_slow * 0.50,
|
||||
) / 11.0;
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.2 + wave_very_slow_cos * 0.05);
|
||||
next.l_hand.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
11.0,
|
||||
-10.0 + wave_very_slow * 2.5,
|
||||
18.5 + wave_very_slow * 1.0,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.9 - wave_very_slow * 0.10);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
10.0,
|
||||
6.0 - wave_very_slow * 1.50,
|
||||
14.5 + wave_very_slow * 0.50,
|
||||
) / 11.0;
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.1 + wave_very_slow * 0.05);
|
||||
next.r_hand.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.4, 1.0, 8.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(
|
||||
@ -91,7 +91,7 @@ impl Animation for GlidingAnimation {
|
||||
);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-5.0, -6.0, 19.0);
|
||||
next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
@ -103,17 +103,10 @@ impl Animation for GlidingAnimation {
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_shoulder.scale = Vec3::one();
|
||||
|
||||
next.draw.offset = Vec3::new(13.5, 3.0, -1.0);
|
||||
next.draw.ori = Quaternion::rotation_y(wave_very_slow_cos * 0.05);
|
||||
next.draw.offset = Vec3::new(5.5, -9.0 + wave_very_slow * 0.10, 18.0);
|
||||
next.draw.ori = Quaternion::rotation_x(0.95 - wave_very_slow * 0.15) * Quaternion::rotation_y(wave_very_slow_cos * 0.04);
|
||||
next.draw.scale = Vec3::one();
|
||||
|
||||
next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.l_hold.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_hold.scale = Vec3::one();
|
||||
|
||||
next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.r_hold.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_hold.scale = Vec3::one();
|
||||
|
||||
next.torso.offset = Vec3::new(-0.5, -0.2, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_x(-0.8 + wave_very_slow * 0.10);
|
||||
|
@ -63,18 +63,18 @@ impl Animation for IdleAnimation {
|
||||
-6.0,
|
||||
-2.0 + wave_ultra_slow_cos * 0.15,
|
||||
11.5 + wave_ultra_slow * 0.5,
|
||||
);
|
||||
) / 11.;
|
||||
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
next.l_hand.scale = Vec3::one() / 11.;
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
9.0,
|
||||
-2.0 + wave_ultra_slow_cos * 0.15,
|
||||
11.5 + wave_ultra_slow * 0.5,
|
||||
);
|
||||
) / 11.;
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
next.r_hand.scale = Vec3::one() / 11.;
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0);
|
||||
next.l_foot.ori = Quaternion::identity();
|
||||
@ -84,7 +84,7 @@ impl Animation for IdleAnimation {
|
||||
next.r_foot.ori = Quaternion::identity();
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0);
|
||||
next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
@ -100,13 +100,6 @@ impl Animation for IdleAnimation {
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.l_hold.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_hold.scale = Vec3::one();
|
||||
|
||||
next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.r_hold.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_hold.scale = Vec3::one();
|
||||
|
||||
next.torso.offset = Vec3::new(-0.5, -0.2, 0.1);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
|
@ -47,13 +47,13 @@ impl Animation for JumpAnimation {
|
||||
next.shorts.ori = Quaternion::rotation_z(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(-6.0, 0.0, 12.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 1.2 - wave_slow * 0.15);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
next.l_hand.offset = Vec3::new(-8.0, 0.0 + wave_stop * 3.2, 7.0 + wave_stop * 3.2 -wave * 0.3) / 11.0;
|
||||
next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 0.6);
|
||||
next.l_hand.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.r_hand.offset = Vec3::new(9.0, 0.0, 12.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(wave_stop_alt * -1.2 + wave_slow * 0.15);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
next.r_hand.offset = Vec3::new(8.0, 0.0 + wave_stop * -3.2, 7.0 + wave_stop * 3.2 - wave * 0.3) / 11.0;
|
||||
next.r_hand.ori = Quaternion::rotation_x(-wave_stop_alt * 0.6);
|
||||
next.r_hand.scale = Vec3::one() / 11.0;
|
||||
|
||||
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);
|
||||
@ -63,7 +63,7 @@ impl Animation for JumpAnimation {
|
||||
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(-5.0, -6.0, 19.0);
|
||||
next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
@ -79,13 +79,7 @@ impl Animation for JumpAnimation {
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.l_hold.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_hold.scale = Vec3::one();
|
||||
|
||||
next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.r_hold.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_hold.scale = Vec3::one();
|
||||
|
||||
next.torso.offset = Vec3::new(-0.5, -0.2, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_x(-0.2);
|
||||
|
@ -33,8 +33,7 @@ pub struct CharacterSkeleton {
|
||||
l_shoulder: Bone,
|
||||
r_shoulder: Bone,
|
||||
draw: Bone,
|
||||
l_hold: Bone,
|
||||
r_hold: Bone,
|
||||
left_equip: Bone,
|
||||
torso: Bone,
|
||||
}
|
||||
|
||||
@ -53,8 +52,7 @@ impl CharacterSkeleton {
|
||||
l_shoulder: Bone::default(),
|
||||
r_shoulder: Bone::default(),
|
||||
draw: Bone::default(),
|
||||
l_hold: Bone::default(),
|
||||
r_hold: Bone::default(),
|
||||
left_equip: Bone::default(),
|
||||
torso: Bone::default(),
|
||||
}
|
||||
}
|
||||
@ -71,18 +69,20 @@ 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(l_hand_mat),
|
||||
FigureBoneData::new(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 * self.l_hold.compute_base_matrix() * weapon_mat),
|
||||
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 * l_hand_mat * self.draw.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.l_hold.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.r_hold.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.draw.compute_base_matrix()),
|
||||
FigureBoneData::new(self.left_equip.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
@ -99,8 +99,7 @@ impl Skeleton for CharacterSkeleton {
|
||||
self.l_shoulder.interpolate(&target.l_shoulder);
|
||||
self.r_shoulder.interpolate(&target.r_shoulder);
|
||||
self.draw.interpolate(&target.draw);
|
||||
self.l_hold.interpolate(&target.l_hold);
|
||||
self.r_hold.interpolate(&target.r_hold);
|
||||
self.left_equip.interpolate(&target.left_equip);
|
||||
self.torso.interpolate(&target.torso);
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ impl Animation for RunAnimation {
|
||||
let wave_test = (wave.cbrt());
|
||||
let fuzz_wave = (anim_time as f32 * 12.0).sin();
|
||||
let wave_cos = (anim_time as f32 * 14.0).cos();
|
||||
let wave_cosdouble = (anim_time as f32 * 28.0).cos();
|
||||
let wave_slow = (anim_time as f32 * 7.0 + PI).sin();
|
||||
let wave_slow_cos = (anim_time as f32 * 8.0 + PI).cos();
|
||||
let wave_dip = (wave_slow.abs() - 0.5).abs();
|
||||
@ -44,13 +45,13 @@ impl Animation for RunAnimation {
|
||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(-6.0, 0.0 + wave_cos * 2.5, 11.0 - wave * 1.5);
|
||||
next.l_hand.offset = Vec3::new(-8.0, 3.0 + wave_cos * 5.0, 9.0 - wave * 2.0) / 11.0;
|
||||
next.l_hand.ori = Quaternion::rotation_x(wave_cos * 0.9);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
next.l_hand.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.r_hand.offset = Vec3::new(9.0, 0.0 - wave_cos * 2.5, 11.0 + wave * 1.5);
|
||||
next.r_hand.offset = Vec3::new(8.0, 3.0 - wave_cos * 5.0, 9.0 + wave * 2.0) / 11.0;
|
||||
next.r_hand.ori = Quaternion::rotation_x(wave_cos * -0.9);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
next.r_hand.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave * 1.0, 6.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave * 1.5);
|
||||
@ -60,7 +61,7 @@ impl Animation for RunAnimation {
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave * 1.5);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0);
|
||||
next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
@ -80,13 +81,6 @@ impl Animation for RunAnimation {
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.l_hold.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_hold.scale = Vec3::one();
|
||||
|
||||
next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.r_hold.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_hold.scale = Vec3::one();
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -69,8 +69,8 @@ impl FigureModelCache {
|
||||
Some(Self::load_left_shoulder(body.shoulder)),
|
||||
Some(Self::load_right_shoulder(body.shoulder)),
|
||||
Some(Self::load_draw(body.draw)),
|
||||
Some(Self::load_left_hold(body.hand)),
|
||||
Some(Self::load_right_hold(body.hand)),
|
||||
Some(Self::load_left_equip(body.weapon)),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
],
|
||||
@ -181,7 +181,7 @@ impl FigureModelCache {
|
||||
match hand {
|
||||
Hand::Default => "figure/body/hand.vox",
|
||||
},
|
||||
Vec3::new(2.0, 0.0, -7.0),
|
||||
Vec3::new(-2.0, -2.5, -2.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ impl FigureModelCache {
|
||||
match hand {
|
||||
Hand::Default => "figure/body/hand.vox",
|
||||
},
|
||||
Vec3::new(2.0, 0.0, -7.0),
|
||||
Vec3::new(-2.0, -2.5, -2.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -252,23 +252,18 @@ impl FigureModelCache {
|
||||
)
|
||||
}
|
||||
|
||||
fn load_left_hold(hand: Hand) -> Mesh<FigurePipeline> {
|
||||
fn load_left_equip(weapon: Weapon) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match hand {
|
||||
Hand::Default => "figure/body/hand.vox",
|
||||
match weapon {
|
||||
Weapon::Sword => "weapon/sword/sword_wood_2h.vox",
|
||||
_ => "weapon/sword/sword_wood_2h.vox",
|
||||
|
||||
},
|
||||
Vec3::new(-2.0, -2.5, 0.0),
|
||||
Vec3::new(-6.5, -1.5, -5.0),
|
||||
)
|
||||
}
|
||||
|
||||
fn load_right_hold(hand: Hand) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match hand {
|
||||
Hand::Default => "figure/body/hand.vox",
|
||||
},
|
||||
Vec3::new(-2.0, 2.5, 0.0),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fn load_pig_head(pig_head: PigHead) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
|
Loading…
Reference in New Issue
Block a user