mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
cleaning up inconsistencies in animation code
Former-commit-id: 31c8ae92c3ebf9bed01aba29f9a030de334df153
This commit is contained in:
parent
a0c713ff23
commit
cace9c6a8f
@ -86,7 +86,7 @@ impl<'a> System<'a> for Sys {
|
||||
if control.move_dir.magnitude() > 0.01 {
|
||||
Animation::Run
|
||||
} else {
|
||||
Animation::Attack
|
||||
Animation::Idle
|
||||
}
|
||||
} else if gliding {
|
||||
Animation::Gliding
|
||||
|
@ -47,19 +47,19 @@ impl Animation for AttackAnimation {
|
||||
.sin()
|
||||
* 0.25,
|
||||
);
|
||||
next.head.offset = Vec3::new(5.5, 2.0, 11.0);
|
||||
next.head.offset = Vec3::new(0.0, 2.0, 11.0);
|
||||
next.head.ori = Quaternion::rotation_z(0.0);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(5.5, 0.0, 7.0);
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
|
||||
next.chest.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(5.5, 0.0, 5.0);
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
|
||||
next.belt.ori = Quaternion::rotation_x(0.0);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(5.5, 0.0, 2.0);
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
@ -87,7 +87,7 @@ impl Animation for AttackAnimation {
|
||||
next.r_foot.ori = Quaternion::identity();
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0);
|
||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
@ -99,8 +99,7 @@ impl Animation for AttackAnimation {
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.04;
|
||||
|
||||
next.draw.offset = Vec3::new(5.5, 0.0, 0.0);
|
||||
|
||||
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;
|
||||
|
||||
@ -108,8 +107,11 @@ impl Animation for AttackAnimation {
|
||||
next.left_equip.ori = Quaternion::rotation_x(0.0 + wave * 2.0)* Quaternion::rotation_z(1.57 + wave * 2.0);
|
||||
next.left_equip.scale = Vec3::one() / 11.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.5, -0.2, 0.1);
|
||||
next.torso.offset = Vec3::new(0.0, -0.2, 0.1);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
next
|
||||
|
@ -46,20 +46,20 @@ impl Animation for GlidingAnimation {
|
||||
.sin()
|
||||
* 0.25,
|
||||
);
|
||||
next.head.offset = Vec3::new(5.5, 2.0, 12.0);
|
||||
next.head.offset = Vec3::new(0.0, 2.0, 12.0);
|
||||
next.head.ori = Quaternion::rotation_x(0.35 - wave_very_slow * 0.10 + head_look.y)
|
||||
* Quaternion::rotation_z(head_look.x + wave_very_slow_cos * 0.15);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(5.5, 0.0, 8.0);
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 8.0);
|
||||
next.chest.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.15);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(5.5, 0.0, 6.0);
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 6.0);
|
||||
next.belt.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.20);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(5.5, 0.0, 3.0);
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 3.0);
|
||||
next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
@ -92,7 +92,7 @@ impl Animation for GlidingAnimation {
|
||||
);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0);
|
||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
@ -105,7 +105,7 @@ impl Animation for GlidingAnimation {
|
||||
next.r_shoulder.scale = Vec3::one() * 1.04;
|
||||
|
||||
|
||||
next.draw.offset = Vec3::new(5.5, -9.0 + wave_very_slow * 0.10, 18.0);
|
||||
next.draw.offset = Vec3::new(0.0, -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();
|
||||
|
||||
@ -113,8 +113,11 @@ impl Animation for GlidingAnimation {
|
||||
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.5, -0.2, 0.0);
|
||||
next.torso.offset = Vec3::new(0.0, -0.2, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_x(-0.8 + wave_very_slow * 0.10);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
|
||||
|
@ -39,19 +39,19 @@ impl Animation for IdleAnimation {
|
||||
.sin()
|
||||
* 0.25,
|
||||
);
|
||||
next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wave_ultra_slow * 0.3);
|
||||
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.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wave_ultra_slow * 0.3);
|
||||
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.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + wave_ultra_slow * 0.3);
|
||||
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.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + wave_ultra_slow * 0.3);
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_ultra_slow * 0.3);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
@ -59,7 +59,6 @@ impl Animation for IdleAnimation {
|
||||
-7.5,
|
||||
-2.0 + wave_ultra_slow_cos * 0.15,
|
||||
8.0 + wave_ultra_slow * 0.5,
|
||||
11.5 + wave_ultra_slow * 0.5,
|
||||
) / 11.0;
|
||||
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06);
|
||||
@ -74,15 +73,15 @@ impl Animation for IdleAnimation {
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06);
|
||||
next.r_hand.scale = Vec3::one() / 11.;
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0);
|
||||
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0);
|
||||
next.l_foot.ori = Quaternion::identity();
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(4.1, -0.1, 8.0);
|
||||
next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0);
|
||||
next.r_foot.ori = Quaternion::identity();
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0);
|
||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
@ -94,21 +93,19 @@ impl Animation for IdleAnimation {
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.04;
|
||||
|
||||
next.draw.offset = Vec3::new(5.5, 0.0, 0.0);
|
||||
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.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.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.draw.offset = Vec3::new(13.5, 0.0, 0.0);
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.scale = Vec3::one() * 0.0;
|
||||
|
||||
|
||||
next.torso.offset = Vec3::new(-0.5, -0.2, 0.1);
|
||||
next.torso.offset = Vec3::new(0.0, -0.2, 0.1);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
|
||||
|
@ -25,19 +25,19 @@ impl Animation for JumpAnimation {
|
||||
let wave_stop_alt = (anim_time as f32 * 5.0).min(PI / 2.0).sin();
|
||||
|
||||
|
||||
next.head.offset = Vec3::new(5.5, 2.0, 12.0);
|
||||
next.head.ori = Quaternion::rotation_x(0.25);
|
||||
next.head.offset = Vec3::new(0.0, 3.0, 13.0);
|
||||
next.head.ori = Quaternion::rotation_x(0.25 + wave_stop * 0.1 + wave_slow * 0.04);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(5.5, 0.0, 8.0);
|
||||
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(5.5, 0.0, 6.0);
|
||||
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(5.5, 0.0, 3.0);
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 3.0);
|
||||
next.shorts.ori = Quaternion::rotation_z(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
@ -57,7 +57,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(-9.0, -5.0, 15.0);
|
||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
@ -69,7 +69,7 @@ impl Animation for JumpAnimation {
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.04;
|
||||
|
||||
next.draw.offset = Vec3::new(5.5, 0.0, 0.0);
|
||||
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;
|
||||
|
||||
@ -77,13 +77,11 @@ impl Animation for JumpAnimation {
|
||||
next.left_equip.ori = Quaternion::rotation_x(0.0);;
|
||||
next.left_equip.scale = Vec3::one() *0.0;
|
||||
|
||||
next.draw.offset = Vec3::new(13.5, 0.0, 0.0);
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.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.5, -0.2, 0.0);
|
||||
next.torso.offset = Vec3::new(0.0, -0.2, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_x(-0.2);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
|
||||
|
@ -34,6 +34,7 @@ pub struct CharacterSkeleton {
|
||||
r_shoulder: Bone,
|
||||
draw: Bone,
|
||||
left_equip: Bone,
|
||||
right_equip: Bone,
|
||||
torso: Bone,
|
||||
}
|
||||
|
||||
@ -53,6 +54,7 @@ impl CharacterSkeleton {
|
||||
r_shoulder: Bone::default(),
|
||||
draw: Bone::default(),
|
||||
left_equip: Bone::default(),
|
||||
right_equip: Bone::default(),
|
||||
torso: Bone::default(),
|
||||
}
|
||||
}
|
||||
@ -78,9 +80,9 @@ impl Skeleton for CharacterSkeleton {
|
||||
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(),
|
||||
|
||||
|
||||
]
|
||||
@ -100,6 +102,7 @@ impl Skeleton for CharacterSkeleton {
|
||||
self.r_shoulder.interpolate(&target.r_shoulder);
|
||||
self.draw.interpolate(&target.draw);
|
||||
self.left_equip.interpolate(&target.left_equip);
|
||||
self.right_equip.interpolate(&target.right_equip);
|
||||
self.torso.interpolate(&target.torso);
|
||||
}
|
||||
}
|
||||
|
@ -36,19 +36,19 @@ impl Animation for RunAnimation {
|
||||
* 0.1,
|
||||
);
|
||||
|
||||
next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wave_cos * 1.3);
|
||||
next.head.offset = Vec3::new(0.0, 3.0, 12.0 + wave_cos * 1.3);
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y + 0.35);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wave_cos * 1.1);
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 1.1);
|
||||
next.chest.ori = Quaternion::rotation_z(wave * 0.1);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + wave_cos * 1.1);
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_cos * 1.1);
|
||||
next.belt.ori = Quaternion::rotation_z(wave * 0.25);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + wave_cos * 1.1);
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_cos * 1.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
@ -68,7 +68,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(-9.0, -5.0, 15.0);
|
||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
@ -80,17 +80,22 @@ impl Animation for RunAnimation {
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.04;
|
||||
|
||||
next.torso.offset = Vec3::new(-0.5, -0.2, 0.4);
|
||||
next.torso.ori = Quaternion::rotation_x(-velocity * 0.05 - wave_cos * 0.1);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
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.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.draw.offset = Vec3::new(5.5, 0.0, 0.0);
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.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
|
||||
|
@ -70,7 +70,7 @@ impl FigureModelCache {
|
||||
Some(Self::load_right_shoulder(body.shoulder)),
|
||||
Some(Self::load_draw(body.draw)),
|
||||
Some(Self::load_left_equip(body.weapon)),
|
||||
None,
|
||||
Some(Self::load_right_equip(body.hand)),
|
||||
None,
|
||||
None,
|
||||
],
|
||||
@ -138,6 +138,7 @@ impl FigureModelCache {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fn load_chest(chest: Chest) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match chest {
|
||||
@ -200,7 +201,7 @@ impl FigureModelCache {
|
||||
Foot::Default => "figure/body/foot.vox",
|
||||
Foot::Dark => "armor/foot/foot_dark.vox",
|
||||
},
|
||||
Vec3::new(2.5, -3.5, -9.0),
|
||||
Vec3::new(-2.5, -3.5, -9.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -210,7 +211,7 @@ impl FigureModelCache {
|
||||
Foot::Default => "figure/body/foot.vox",
|
||||
Foot::Dark => "armor/foot/foot_dark.vox",
|
||||
},
|
||||
Vec3::new(2.5, -3.5, -9.0),
|
||||
Vec3::new(-2.5, -3.5, -9.0),
|
||||
)
|
||||
}
|
||||
|
||||
@ -262,6 +263,15 @@ impl FigureModelCache {
|
||||
Vec3::new(-6.5, -1.5, -5.0),
|
||||
)
|
||||
}
|
||||
fn load_right_equip(hand: Hand) -> Mesh<FigurePipeline> {
|
||||
Self::load_mesh(
|
||||
match hand {
|
||||
Hand::Default => "figure/body/hand.vox",
|
||||
},
|
||||
Vec3::new(-2.0, -2.5, -2.0),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user