mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Better animations
This commit is contained in:
parent
e3cbdc82bc
commit
73ac1c5600
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.
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.
@ -17,11 +17,6 @@ impl Animation for FlyAnimation {
|
||||
) -> 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 * 3.0 + PI).cos();
|
||||
let wave_slow = (anim_time as f32 * 4.5).sin();
|
||||
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
|
||||
|
||||
let lab = 12.0; //14.0
|
||||
|
||||
let footl = (anim_time as f32 * lab as f32 + PI).sin();
|
||||
|
@ -4,6 +4,15 @@ use vek::*;
|
||||
|
||||
pub struct FlyAnimation;
|
||||
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
|
||||
const TEST_1: f32 = 0.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
|
||||
const TEST_2: f32 = 0.0;
|
||||
#[const_tweaker::tweak(min = -1.0, max = 1.0, step = 0.01)]
|
||||
const TEST_3: f32 = 0.0;
|
||||
#[const_tweaker::tweak(min = -1.0, max = 1.0, step = 0.01)]
|
||||
const TEST_4: f32 = 0.0;
|
||||
|
||||
impl Animation for FlyAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = DragonSkeleton;
|
||||
@ -24,6 +33,9 @@ impl Animation for FlyAnimation {
|
||||
let wave_slow = (anim_time as f32 * 4.5).sin();
|
||||
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
|
||||
|
||||
let wingl = (anim_time as f32 * 2.0 + PI).sin();
|
||||
let wingr = (anim_time as f32 * 2.0).sin();
|
||||
|
||||
let vertlf = (anim_time as f32 * lab as f32 + PI * 1.8).sin().max(0.15);
|
||||
let vertrfoffset = (anim_time as f32 * lab as f32 + PI * 0.80).sin().max(0.15);
|
||||
let vertlboffset = (anim_time as f32 * lab as f32).sin().max(0.15);
|
||||
@ -61,14 +73,22 @@ impl Animation for FlyAnimation {
|
||||
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
|
||||
let wave_stop = (anim_time as f32 * 5.0).min(PI / 2.0).sin();
|
||||
|
||||
next.head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) * 1.05;
|
||||
next.head_upper.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.head_upper.0,
|
||||
skeleton_attr.head_upper.1 + wave_ultra_slow * 0.20,
|
||||
) * 1.05;
|
||||
next.head_upper.ori =
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
|
||||
next.head_upper.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.head_lower.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) * 1.05;
|
||||
next.head_lower.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.head_lower.0,
|
||||
skeleton_attr.head_lower.1 + wave_ultra_slow * 0.20,
|
||||
) * 1.05;
|
||||
next.head_lower.ori =
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
|
||||
next.head_lower.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.jaw.offset = Vec3::new(
|
||||
@ -148,7 +168,7 @@ impl Animation for FlyAnimation {
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_l.ori = Quaternion::rotation_y((0.57 + footl * 1.2).max(0.0));
|
||||
next.wing_in_l.ori = Quaternion::rotation_y((0.15 + wingl * 0.6).max(0.2));
|
||||
next.wing_in_l.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_in_r.offset = Vec3::new(
|
||||
@ -156,7 +176,7 @@ impl Animation for FlyAnimation {
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_r.ori = Quaternion::rotation_y((-0.57 + footr * 1.2).min(0.0));
|
||||
next.wing_in_r.ori = Quaternion::rotation_y((-0.15 + wingr * 0.6).min(0.2));
|
||||
next.wing_in_r.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_out_l.offset = Vec3::new(
|
||||
@ -164,7 +184,7 @@ impl Animation for FlyAnimation {
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
);
|
||||
next.wing_out_l.ori = Quaternion::rotation_y((0.57 + footl * 1.2).max(0.0));
|
||||
next.wing_out_l.ori = Quaternion::rotation_y((0.35 + wingl * 0.6).max(0.0));
|
||||
next.wing_out_l.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_out_r.offset = Vec3::new(
|
||||
@ -172,7 +192,7 @@ impl Animation for FlyAnimation {
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
);
|
||||
next.wing_out_r.ori = Quaternion::rotation_y((-0.57 + footr * 1.2).min(0.0));
|
||||
next.wing_out_r.ori = Quaternion::rotation_y((-0.35 + wingr * 0.6).min(0.0));
|
||||
next.wing_out_r.scale = Vec3::one() * 1.05;
|
||||
|
||||
next
|
||||
|
@ -4,6 +4,15 @@ use vek::*;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
|
||||
const TEST_R: f32 = 2.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
|
||||
const TEST_L: f32 = -2.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
|
||||
const OFF1: f32 = -1.4;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
|
||||
const OFF2: f32 = -1.4;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = DragonSkeleton;
|
||||
@ -38,7 +47,7 @@ impl Animation for IdleAnimation {
|
||||
next.head_upper.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.head_upper.0,
|
||||
skeleton_attr.head_upper.1 + wave_ultra_slow * 0.4,
|
||||
skeleton_attr.head_upper.1 + wave_ultra_slow * 0.20,
|
||||
) * 1.05;
|
||||
next.head_upper.ori =
|
||||
Quaternion::rotation_z(0.8 * look.x) * Quaternion::rotation_x(0.8 * look.y);
|
||||
@ -48,16 +57,16 @@ impl Animation for IdleAnimation {
|
||||
0.0,
|
||||
skeleton_attr.head_lower.0,
|
||||
skeleton_attr.head_lower.1 + wave_ultra_slow * 0.20,
|
||||
);
|
||||
) * 1.05;
|
||||
next.head_lower.ori =
|
||||
Quaternion::rotation_z(-0.4 * look.x) * Quaternion::rotation_x(-0.4 * look.y);
|
||||
Quaternion::rotation_z(0.8 * look.x) * Quaternion::rotation_x(0.8 * look.y);
|
||||
next.head_lower.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.jaw.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.jaw.0 - wave_ultra_slow_cos * 0.12,
|
||||
skeleton_attr.jaw.1 + wave_slow * 0.2,
|
||||
);
|
||||
) * 1.05;
|
||||
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
|
||||
next.jaw.scale = Vec3::one() * 0.98;
|
||||
|
||||
@ -90,7 +99,7 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_l.ori = Quaternion::rotation_y(wave_ultra_slow * -0.5);
|
||||
next.wing_in_l.ori = Quaternion::rotation_y(1.3);
|
||||
next.wing_in_l.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_in_r.offset = Vec3::new(
|
||||
@ -98,23 +107,23 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_r.ori = Quaternion::rotation_y(wave_ultra_slow * 0.5);
|
||||
next.wing_in_r.ori = Quaternion::rotation_y(-1.3);
|
||||
next.wing_in_r.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_out_l.offset = Vec3::new(
|
||||
-skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
skeleton_attr.wing_out.2 + *OFF1,
|
||||
);
|
||||
next.wing_out_l.ori = Quaternion::rotation_y(wave_ultra_slow * -0.5);
|
||||
next.wing_out_l.ori = Quaternion::rotation_y(*TEST_L);
|
||||
next.wing_out_l.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_out_r.offset = Vec3::new(
|
||||
skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
skeleton_attr.wing_out.2 + *OFF2,
|
||||
);
|
||||
next.wing_out_r.ori = Quaternion::rotation_y(wave_ultra_slow * 0.5);
|
||||
next.wing_out_r.ori = Quaternion::rotation_y(*TEST_R);
|
||||
next.wing_out_r.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.foot_fl.offset = Vec3::new(
|
||||
|
@ -15,7 +15,7 @@ const HEAD_UPPER_X: f32 = 2.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const HEAD_UPPER_Z: f32 = 4.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const HEAD_LOWER_X: f32 = 8.0;
|
||||
const HEAD_LOWER_X: f32 = 7.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const HEAD_LOWER_Z: f32 = 3.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
@ -27,7 +27,7 @@ const CHEST_F_X: f32 = 0.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const CHEST_F_Z: f32 = 14.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const CHEST_R_X: f32 = -13.0;
|
||||
const CHEST_R_X: f32 = -12.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const CHEST_R_Z: f32 = 0.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
@ -35,9 +35,9 @@ const TAIL_F_X: f32 = -12.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const TAIL_F_Z: f32 = 1.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const TAIL_R_X: f32 = -30.0;
|
||||
const TAIL_R_X: f32 = -14.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const TAIL_R_Z: f32 = 14.0;
|
||||
const TAIL_R_Z: f32 = 0.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const WING_IN_X: f32 = 2.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
@ -51,13 +51,13 @@ const WING_OUT_Y: f32 = 0.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const WING_OUT_Z: f32 = 4.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const FEET_F_X: f32 = 4.0;
|
||||
const FEET_F_X: f32 = 6.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const FEET_F_Y: f32 = 0.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const FEET_F_Z: f32 = 1.5;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const FEET_B_X: f32 = 4.0;
|
||||
const FEET_B_X: f32 = 6.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
const FEET_B_Y: f32 = -15.0;
|
||||
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
|
||||
@ -128,17 +128,17 @@ impl Skeleton for DragonSkeleton {
|
||||
)
|
||||
=======
|
||||
[
|
||||
FigureBoneData::new(chest_front_mat * head_lower_mat*head_upper_mat),
|
||||
FigureBoneData::new(chest_front_mat * head_lower_mat * head_upper_mat),
|
||||
FigureBoneData::new(chest_front_mat * head_lower_mat),
|
||||
FigureBoneData::new(chest_front_mat * head_lower_mat*head_upper_mat * self.jaw.compute_base_matrix()),
|
||||
FigureBoneData::new(chest_front_mat * head_lower_mat * head_upper_mat * self.jaw.compute_base_matrix()),
|
||||
FigureBoneData::new(chest_front_mat),
|
||||
FigureBoneData::new(chest_front_mat * self.chest_rear.compute_base_matrix() ),
|
||||
FigureBoneData::new(chest_front_mat*chest_rear_mat * tail_front_mat),
|
||||
FigureBoneData::new(self.tail_rear.compute_base_matrix() * tail_front_mat),
|
||||
FigureBoneData::new(chest_front_mat * chest_rear_mat * tail_front_mat),
|
||||
FigureBoneData::new(chest_front_mat * chest_rear_mat * tail_front_mat * self.tail_rear.compute_base_matrix()),
|
||||
FigureBoneData::new(chest_front_mat * self.wing_in_l.compute_base_matrix()),
|
||||
FigureBoneData::new(chest_front_mat * self.wing_in_r.compute_base_matrix()),
|
||||
FigureBoneData::new(chest_front_mat*wing_in_l_mat*self.wing_out_l.compute_base_matrix()),
|
||||
FigureBoneData::new(chest_front_mat*wing_in_r_mat*self.wing_out_r.compute_base_matrix()),
|
||||
FigureBoneData::new(chest_front_mat * wing_in_l_mat * self.wing_out_l.compute_base_matrix()),
|
||||
FigureBoneData::new(chest_front_mat * wing_in_r_mat * self.wing_out_r.compute_base_matrix()),
|
||||
FigureBoneData::new(self.foot_fl.compute_base_matrix()),
|
||||
FigureBoneData::new(self.foot_fr.compute_base_matrix()),
|
||||
FigureBoneData::new(self.foot_bl.compute_base_matrix()),
|
||||
@ -244,10 +244,10 @@ impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
|
||||
(Reddragon, _) => (*WING_OUT_X, *WING_OUT_Y, *WING_OUT_Z),
|
||||
},
|
||||
feet_f: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (4.0, 0.0, 1.5),
|
||||
(Reddragon, _) => (*FEET_F_X, *FEET_F_Y, *FEET_F_Z),
|
||||
},
|
||||
feet_b: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (4.0, -15.0, 3.0),
|
||||
(Reddragon, _) => (*FEET_B_X, *FEET_B_Y, *FEET_B_Z),
|
||||
},
|
||||
height: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (1.0),
|
||||
|
@ -59,8 +59,8 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.head_upper.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.head_upper.0 + horichest * 1.8,
|
||||
skeleton_attr.head_upper.1 + verthead * -1.8,
|
||||
skeleton_attr.head_upper.0,
|
||||
skeleton_attr.head_upper.1,
|
||||
) * 1.05;
|
||||
next.head_upper.ori =
|
||||
Quaternion::rotation_x(wolf_look.y) * Quaternion::rotation_z(wolf_look.x);
|
||||
@ -68,11 +68,10 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.head_lower.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.head_lower.0 + horichest * 1.8,
|
||||
skeleton_attr.head_lower.1 + verthead * -1.8,
|
||||
skeleton_attr.head_lower.0,
|
||||
skeleton_attr.head_lower.1,
|
||||
) * 1.05;
|
||||
next.head_lower.ori =
|
||||
Quaternion::rotation_x(wolf_look.y) * Quaternion::rotation_z(wolf_look.x);
|
||||
next.head_lower.ori = Quaternion::rotation_x(wave_slow * 0.05);
|
||||
next.head_lower.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.jaw.offset = Vec3::new(
|
||||
@ -81,7 +80,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.jaw.1 + wave_slow * 0.2,
|
||||
);
|
||||
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
|
||||
next.jaw.scale = Vec3::one() * 0.98;
|
||||
next.jaw.scale = Vec3::one();
|
||||
|
||||
next.tail_front.offset = Vec3::new(
|
||||
0.0,
|
||||
@ -105,15 +104,15 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.chest_front.1 + vertchest * -1.6 + 1.0,
|
||||
) * 1.05;
|
||||
next.chest_front.ori = Quaternion::rotation_y(horichest * -0.09);
|
||||
next.chest_front.scale = Vec3::one() * 0.98 * 1.05;
|
||||
next.chest_front.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.chest_rear.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest_rear.0 + horichest * 1.25,
|
||||
skeleton_attr.chest_rear.1 + vertchest * -1.6 + 1.0,
|
||||
skeleton_attr.chest_rear.0,
|
||||
skeleton_attr.chest_rear.1,
|
||||
) * 1.05;
|
||||
next.chest_rear.ori = Quaternion::rotation_y(horichest * -0.09);
|
||||
next.chest_rear.scale = Vec3::one() * 0.98 * 1.05;
|
||||
next.chest_rear.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.foot_fl.offset = Vec3::new(
|
||||
-skeleton_attr.feet_f.0,
|
||||
@ -152,7 +151,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_l.ori = Quaternion::rotation_y((footl * 0.35).max(0.0));
|
||||
next.wing_in_l.ori = Quaternion::rotation_y(1.3);
|
||||
next.wing_in_l.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_in_r.offset = Vec3::new(
|
||||
@ -160,23 +159,23 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_r.ori = Quaternion::rotation_y((footr * 0.35).max(0.0));
|
||||
next.wing_in_r.ori = Quaternion::rotation_y(-1.3);
|
||||
next.wing_in_r.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_out_l.offset = Vec3::new(
|
||||
-skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
skeleton_attr.wing_out.2 - 1.4,
|
||||
);
|
||||
next.wing_out_l.ori = Quaternion::rotation_y((footl * 0.35).max(0.0));
|
||||
next.wing_out_l.ori = Quaternion::rotation_y(-2.5);
|
||||
next.wing_out_l.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_out_r.offset = Vec3::new(
|
||||
skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
skeleton_attr.wing_out.2 - 1.4,
|
||||
);
|
||||
next.wing_out_r.ori = Quaternion::rotation_y((footr * 0.35).max(0.0));
|
||||
next.wing_out_r.ori = Quaternion::rotation_y(2.5);
|
||||
next.wing_out_r.scale = Vec3::one() * 1.05;
|
||||
|
||||
next
|
||||
|
Loading…
x
Reference in New Issue
Block a user