mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
More new style keyframe translation
This commit is contained in:
parent
c878673a84
commit
72b15a1e24
@ -35,6 +35,13 @@ impl Animation for SpinAnimation {
|
||||
|
||||
let lab = 1.0;
|
||||
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
let foot = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 10.32).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
@ -45,10 +52,8 @@ impl Animation for SpinAnimation {
|
||||
let spin = (anim_time as f32 * 2.8 * lab as f32).sin();
|
||||
let spinhalf = (anim_time as f32 * 1.4 * lab as f32).sin();
|
||||
|
||||
let build = (anim_time as f32 * 8.0).sin();
|
||||
let recover = (anim_time as f32 * 8.0).sin();
|
||||
fn slow(x: f32) -> f32 { (x * 8.0).sin() }
|
||||
|
||||
let movement = anim_time as f32 * 1.0;
|
||||
let stab = (anim_time as f32 * 8.0).sin();
|
||||
let rotate = (anim_time as f32 * 1.0).sin();
|
||||
|
||||
@ -66,56 +71,39 @@ impl Animation for SpinAnimation {
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Buildup => {
|
||||
next.control.position =
|
||||
Vec3::new(5.0, 11.0 + build * 0.6, 2.0 + build * 0.6);
|
||||
next.control.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(-0.57 + movement * 2.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.upper_torso.orientation = Quaternion::rotation_y(movement * -0.1)
|
||||
* Quaternion::rotation_z(-1.07 + movement * -0.6);
|
||||
next.control.position = Vec3::new(
|
||||
5.0 + movement1 * 2.0 + movement2 * -8.0 + movement3 * -7.0,
|
||||
11.0 + slow(movement1) * 0.6
|
||||
+ slow(movement2) * 3.0
|
||||
+ slow(movement3) * -0.8
|
||||
+ movement3 * -10.0,
|
||||
2.0 + slow(movement1) * 0.6
|
||||
+ slow(movement2) * 3.5
|
||||
+ movement2 * 3.0
|
||||
+ slow(movement3) * -0.4
|
||||
+ movement3 * -4.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(
|
||||
movement1 * -1.57 + movement2 * -0.6 + slow(movement2) * -0.25,
|
||||
) * Quaternion::rotation_y(
|
||||
-0.57 + movement1 * 2.0 + movement2 * -2.0,
|
||||
) * Quaternion::rotation_z(movement1 + movement2);
|
||||
|
||||
next.lower_torso.orientation = Quaternion::rotation_x(movement * 0.1);
|
||||
next.head.orientation = Quaternion::rotation_z(slow(movement2) * -0.8);
|
||||
|
||||
next.head.orientation = Quaternion::rotation_y(movement * 0.1)
|
||||
* Quaternion::rotation_z(1.07 + movement * 0.4);
|
||||
},
|
||||
StageSection::Swing => {
|
||||
next.control.position = Vec3::new(
|
||||
7.0 + movement * -8.0,
|
||||
11.0 + stab * 3.0,
|
||||
2.0 + stab * 3.5 + movement * 3.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(-1.57 + movement * -0.6 + stab * -0.25)
|
||||
* Quaternion::rotation_y(2.8 + movement * -2.0)
|
||||
* Quaternion::rotation_z(1.0 + movement * 1.0);
|
||||
next.head.orientation = Quaternion::rotation_z(-stab * 0.8);
|
||||
next.upper_torso.orientation = Quaternion::rotation_x(stab * 0.15)
|
||||
* Quaternion::rotation_y(movement * 0.3)
|
||||
* Quaternion::rotation_z(movement * 1.5);
|
||||
next.lower_torso.orientation = Quaternion::rotation_z(rotate * 1.5);
|
||||
next.torso.orientation = Quaternion::rotation_z(rotate * 7.2);
|
||||
},
|
||||
StageSection::Recover => {
|
||||
next.control.position = Vec3::new(
|
||||
-8.0,
|
||||
11.0 - recover * 0.8 + movement * -10.0,
|
||||
6.0 - recover * 0.4 + movement * -4.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(-1.57)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.0);
|
||||
next.upper_torso.orientation = Quaternion::rotation_y(movement * -0.1)
|
||||
* Quaternion::rotation_z(movement * 0.4);
|
||||
next.head.orientation = Quaternion::rotation_y(movement * 0.1)
|
||||
* Quaternion::rotation_z(movement * -0.1);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
next.upper_torso.orientation = Quaternion::rotation_x(slow(movement2) * 0.15)
|
||||
* Quaternion::rotation_y(movement1 * -0.1 + movement2 * 0.3 + movement3 * -0.1)
|
||||
* Quaternion::rotation_z(
|
||||
-1.0 + movement1 * -0.6 + movement2 * 1.5 + movement3 * 0.5,
|
||||
);
|
||||
|
||||
next.lower_torso.orientation = Quaternion::rotation_x(movement1 * 0.1)
|
||||
* Quaternion::rotation_z(movement2.sin() * 1.5);
|
||||
|
||||
next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 - movement2 * -0.1)
|
||||
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.5);
|
||||
|
||||
next.torso.orientation = Quaternion::rotation_z((movement2).sin() * 7.2);
|
||||
}
|
||||
|
||||
if let Some(ToolKind::Axe(_) | ToolKind::Hammer(_) | ToolKind::Dagger(_)) = active_tool_kind
|
||||
|
@ -34,6 +34,12 @@ impl Animation for SpinMeleeAnimation {
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let lab = 1.0;
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
let mut next = (*skeleton).clone();
|
||||
//torso movement
|
||||
@ -53,7 +59,6 @@ impl Animation for SpinMeleeAnimation {
|
||||
} else {
|
||||
lab as f32 * anim_time as f32 * 0.9
|
||||
};
|
||||
let movement = anim_time as f32 * 1.0;
|
||||
|
||||
//feet
|
||||
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
|
||||
@ -67,76 +72,21 @@ impl Animation for SpinMeleeAnimation {
|
||||
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
|
||||
next.main.position = Vec3::new(0.0, 5.0, 2.0);
|
||||
next.main.position = Vec3::new(3.0, 6.0, -5.0);
|
||||
next.main.orientation = Quaternion::rotation_x(-0.1)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 + 0.0, s_a.head.1);
|
||||
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Buildup => {
|
||||
next.control.position =
|
||||
Vec3::new(-7.0, 7.0 + movement * -8.0, 2.0 + movement * -6.0);
|
||||
next.control.orientation = Quaternion::rotation_x(movement * -0.5)
|
||||
* Quaternion::rotation_y(movement * 0.3)
|
||||
* Quaternion::rotation_z(movement * -1.5);
|
||||
next.upper_torso.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.upper_torso.0 + movement * -1.0,
|
||||
s_a.upper_torso.1 + movement * -2.5,
|
||||
);
|
||||
next.upper_torso.orientation = Quaternion::rotation_x(movement * -1.1)
|
||||
* Quaternion::rotation_z(movement * -0.35);
|
||||
next.lower_torso.orientation = Quaternion::rotation_z(movement * 0.5);
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.head.0 - 2.0 + movement * -6.0,
|
||||
s_a.head.1 + movement * -4.0,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_x(movement * 0.9)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(movement * 0.05);
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-PI / 2.0 + movement3 * PI / 2.0)
|
||||
* Quaternion::rotation_z(-PI / 2.0 + movement3 * PI / 2.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0);
|
||||
|
||||
next.foot_l.position =
|
||||
Vec3::new(-s_a.foot.0, s_a.foot.1 + movement * 4.0, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(movement * 0.2);
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0,
|
||||
s_a.foot.1 + movement * -12.0,
|
||||
s_a.foot.2 + movement * 1.0 + quick * 1.0,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(movement * -1.0)
|
||||
* Quaternion::rotation_z(movement * -0.8);
|
||||
},
|
||||
StageSection::Swing => {
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-PI / 2.0)
|
||||
* Quaternion::rotation_z(-PI / 2.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(movement * PI * 2.0);
|
||||
|
||||
next.upper_torso.position =
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
|
||||
next.upper_torso.orientation = Quaternion::rotation_y(0.3);
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 - 2.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.15);
|
||||
next.lower_torso.orientation = Quaternion::rotation_x(0.2);
|
||||
},
|
||||
StageSection::Recover => {
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 - 2.0, s_a.head.1);
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(-PI / 2.0 + movement * PI / 2.0)
|
||||
* Quaternion::rotation_z(-PI / 2.0 + movement * PI / 2.0);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.15 + movement * 0.15);
|
||||
next.upper_torso.orientation =
|
||||
Quaternion::rotation_y(0.3 + movement * -0.3)
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
|
||||
next.upper_torso.orientation = Quaternion::rotation_y(0.3 + movement3 * -0.3);
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.15 + movement3 * 0.15);
|
||||
next.lower_torso.orientation = Quaternion::rotation_x(0.2);
|
||||
},
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
|
||||
|
@ -35,10 +35,17 @@ impl Animation for RepeaterAnimation {
|
||||
|
||||
let lab = 1.0;
|
||||
|
||||
let (movement1, movement2, movement3, _movement4) = match stage_section {
|
||||
Some(StageSection::Movement) => (anim_time as f32, 0.0, 0.0, 0.0),
|
||||
Some(StageSection::Buildup) => (1.0, anim_time as f32, 0.0, 0.0),
|
||||
Some(StageSection::Shoot) => (1.0, 1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time as f32),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
// end spin stuff
|
||||
|
||||
let movement = (anim_time as f32 * 1.0).min(1.0);
|
||||
let fire = (anim_time as f32 * 18.0 * lab as f32).sin();
|
||||
fn fire (x: f32) -> f32 { (x * 18.0).sin() }
|
||||
|
||||
if let Some(ToolKind::Bow(_)) = active_tool_kind {
|
||||
next.hand_l.position = Vec3::new(2.0, 1.5, 0.0);
|
||||
@ -62,97 +69,46 @@ impl Animation for RepeaterAnimation {
|
||||
|
||||
next.control.position = Vec3::new(-7.0, 6.0, 6.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Movement => {
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0 + movement * -0.75 - 0.75,
|
||||
s_a.foot.1 + movement * 4.0 + 4.0,
|
||||
s_a.foot.2 + movement * 2.5 + 2.5,
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(movement * 0.6 + 0.6)
|
||||
* Quaternion::rotation_z(movement * 0.3 + 0.3);
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0 + movement * 0.75 + 0.75,
|
||||
s_a.foot.1 + movement * 4.0 + 4.0,
|
||||
s_a.foot.2 + movement * 2.5 + 2.5,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(movement * 0.6 + 0.6)
|
||||
* Quaternion::rotation_z(movement * -0.3 - 0.3);
|
||||
next.shorts.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.shorts.0 + movement * 4.0,
|
||||
s_a.shorts.1 + movement * 1.0,
|
||||
);
|
||||
next.shorts.orientation = Quaternion::rotation_x(movement * 0.6);
|
||||
next.belt.position =
|
||||
Vec3::new(0.0, s_a.belt.0 + movement * 2.0, s_a.belt.1);
|
||||
next.belt.orientation = Quaternion::rotation_x(movement * 0.2);
|
||||
next.control.position = Vec3::new(
|
||||
-7.0 + movement * 5.0,
|
||||
6.0 + movement * 3.0,
|
||||
6.0 + movement * 1.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(movement * 0.4)
|
||||
* Quaternion::rotation_y(movement * 0.8);
|
||||
next.head.orientation = Quaternion::rotation_y(movement * 0.15);
|
||||
next.torso.orientation = Quaternion::rotation_x(movement * 0.1)
|
||||
},
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0 + movement1 * -0.75 - 0.75,
|
||||
s_a.foot.1 + movement1 * 4.0 + 4.0,
|
||||
s_a.foot.2 + movement1 * 2.5 + 2.5,
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(movement1 * 0.6 + 0.6 + movement2 * -0.2)
|
||||
* Quaternion::rotation_z(movement1 * 0.3 + 0.3);
|
||||
|
||||
StageSection::Buildup => {
|
||||
next.foot_l.position =
|
||||
Vec3::new(-s_a.foot.0 - 1.5, s_a.foot.1 + 8.0, s_a.foot.2 + 5.0);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(1.2 + movement * -0.2)
|
||||
* Quaternion::rotation_z(0.6);
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0 + movement1 * 0.75 + 0.75,
|
||||
s_a.foot.1 + movement1 * 4.0 + 4.0,
|
||||
s_a.foot.2 + movement1 * 2.5 + 2.5,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(movement1 * 0.6 + 0.6 + movement2 * -0.2)
|
||||
* Quaternion::rotation_z(movement1 * -0.3 - 0.3);
|
||||
next.shorts.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.shorts.0 + movement1 * 4.0,
|
||||
s_a.shorts.1 + movement1 * 1.0,
|
||||
);
|
||||
next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.6);
|
||||
next.belt.position =
|
||||
Vec3::new(0.0, s_a.belt.0 + movement1 * 2.0, s_a.belt.1);
|
||||
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.2);
|
||||
next.control.position = Vec3::new(
|
||||
-7.0 + movement1 * 5.0,
|
||||
6.0 + movement1 * 3.0,
|
||||
6.0 + movement1 * 1.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(movement1 * 0.4)
|
||||
* Quaternion::rotation_y(movement1 * 0.8);
|
||||
next.head.orientation = Quaternion::rotation_y(movement1 * 0.15 + movement2 * 0.05);
|
||||
next.torso.orientation = Quaternion::rotation_x(movement1 * 0.1 + movement2 * 0.1 + movement3 * 0.15);
|
||||
|
||||
next.foot_r.position =
|
||||
Vec3::new(s_a.foot.0 + 1.5, s_a.foot.1 + 8.0, s_a.foot.2 + 5.0);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(1.2 + movement * -0.2)
|
||||
* Quaternion::rotation_z(-0.6);
|
||||
next.shorts.position =
|
||||
Vec3::new(0.0, s_a.shorts.0 + 4.0, s_a.shorts.1 + 1.0);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.6);
|
||||
next.belt.position = Vec3::new(0.0, s_a.belt.0 + 2.0, s_a.belt.1);
|
||||
next.belt.orientation = Quaternion::rotation_x(0.2);
|
||||
next.control.position = Vec3::new(-2.0, 9.0, 7.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(0.4) * Quaternion::rotation_y(0.8);
|
||||
next.head.orientation = Quaternion::rotation_y(0.15 + movement * 0.05);
|
||||
next.torso.orientation = Quaternion::rotation_x(0.1 + movement * 0.1);
|
||||
},
|
||||
|
||||
StageSection::Shoot => {
|
||||
next.foot_l.position =
|
||||
Vec3::new(-s_a.foot.0 - 1.5, s_a.foot.1 + 8.0, s_a.foot.2 + 5.0);
|
||||
next.foot_l.orientation =
|
||||
Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.6);
|
||||
|
||||
next.foot_r.position =
|
||||
Vec3::new(s_a.foot.0 + 1.5, s_a.foot.1 + 8.0, s_a.foot.2 + 5.0);
|
||||
next.foot_r.orientation =
|
||||
Quaternion::rotation_x(1.0) * Quaternion::rotation_z(-0.6);
|
||||
next.shorts.position =
|
||||
Vec3::new(0.0, s_a.shorts.0 + 4.0, s_a.shorts.1 + 1.0);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.6);
|
||||
next.belt.position = Vec3::new(0.0, s_a.belt.0 + 2.0, s_a.belt.1);
|
||||
next.belt.orientation = Quaternion::rotation_x(0.2);
|
||||
next.control.position = Vec3::new(-2.0, 9.0, 7.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(0.4) * Quaternion::rotation_y(0.8);
|
||||
next.head.orientation = Quaternion::rotation_y(0.2);
|
||||
next.torso.orientation = Quaternion::rotation_x(0.2 + movement * 0.15);
|
||||
|
||||
next.hand_l.position =
|
||||
Vec3::new(2.0 + fire * -6.0 - 3.0, 1.5 + fire * -6.0 - 3.0, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.20)
|
||||
* Quaternion::rotation_y(-0.6)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
},
|
||||
StageSection::Recover => {},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
next.hand_l.position =
|
||||
Vec3::new(2.0 + fire(movement3) * -6.0 - 3.0, 1.5 + fire(movement3) * -6.0 - 3.0, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.20)
|
||||
* Quaternion::rotation_y(-0.6)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
}
|
||||
|
||||
next.second.scale = match (
|
||||
|
@ -34,6 +34,12 @@ impl Animation for SpinMeleeAnimation {
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let lab = 1.0;
|
||||
let (movement1, movement2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
let mut next = (*skeleton).clone();
|
||||
//torso movement
|
||||
@ -53,7 +59,6 @@ impl Animation for SpinMeleeAnimation {
|
||||
} else {
|
||||
lab as f32 * anim_time as f32 * 0.9
|
||||
};
|
||||
let movement = anim_time as f32 * 1.0;
|
||||
|
||||
//feet
|
||||
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
|
||||
@ -71,72 +76,18 @@ impl Animation for SpinMeleeAnimation {
|
||||
next.main.orientation = Quaternion::rotation_x(-0.1)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 + 0.0, s_a.head.1);
|
||||
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Buildup => {
|
||||
next.control.position =
|
||||
Vec3::new(-7.0, 7.0 + movement * -8.0, 2.0 + movement * -6.0);
|
||||
next.control.orientation = Quaternion::rotation_x(movement * -0.5)
|
||||
* Quaternion::rotation_y(movement * 0.3)
|
||||
* Quaternion::rotation_z(movement * -1.5);
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.chest.0 + movement * -1.0,
|
||||
s_a.chest.1 + movement * -2.5,
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_x(movement * -1.1)
|
||||
* Quaternion::rotation_z(movement * -0.35);
|
||||
next.belt.orientation = Quaternion::rotation_z(movement * 0.35);
|
||||
next.shorts.orientation = Quaternion::rotation_z(movement * 0.5);
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.head.0 - 2.0 + movement * -6.0,
|
||||
s_a.head.1 + movement * -4.0,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_x(movement * 0.9)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(movement * 0.05);
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-PI / 2.0 + movement3 * PI / 2.0)
|
||||
* Quaternion::rotation_z(-PI / 2.0 + movement3 * PI / 2.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0);
|
||||
|
||||
next.foot_l.position =
|
||||
Vec3::new(-s_a.foot.0, s_a.foot.1 + movement * 4.0, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(movement * 0.2);
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0,
|
||||
s_a.foot.1 + movement * -12.0,
|
||||
s_a.foot.2 + movement * 1.0 + quick * 1.0,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(movement * -1.0)
|
||||
* Quaternion::rotation_z(movement * -0.8);
|
||||
},
|
||||
StageSection::Swing => {
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-PI / 2.0)
|
||||
* Quaternion::rotation_z(-PI / 2.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(movement * PI * 2.0);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_y(0.3);
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 - 2.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.15);
|
||||
next.belt.orientation = Quaternion::rotation_x(0.1);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.2);
|
||||
},
|
||||
StageSection::Recover => {
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 - 2.0, s_a.head.1);
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(-PI / 2.0 + movement * PI / 2.0)
|
||||
* Quaternion::rotation_z(-PI / 2.0 + movement * PI / 2.0);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.15 + movement * 0.15);
|
||||
next.chest.orientation = Quaternion::rotation_y(0.3 + movement * -0.3)
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_y(0.3 + movement3 * -0.3);
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.15 + movement3 * 0.15);
|
||||
next.belt.orientation = Quaternion::rotation_x(0.1);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.2);
|
||||
},
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
|
||||
|
Loading…
Reference in New Issue
Block a user