mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
flayer anims
This commit is contained in:
parent
91ddcaa155
commit
558c82ee54
25
assets/common/abilities/unique/husk/singlestrike.ron
Normal file
25
assets/common/abilities/unique/husk/singlestrike.ron
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
ComboMelee(
|
||||||
|
stage_data: [
|
||||||
|
(
|
||||||
|
stage: 1,
|
||||||
|
base_damage: 90,
|
||||||
|
damage_increase: 0,
|
||||||
|
base_poise_damage: 30,
|
||||||
|
poise_damage_increase: 0,
|
||||||
|
knockback: 5.0,
|
||||||
|
range: 3.5,
|
||||||
|
angle: 60.0,
|
||||||
|
base_buildup_duration: 0.25,
|
||||||
|
base_swing_duration: 0.07,
|
||||||
|
base_recover_duration: 0.25,
|
||||||
|
forward_movement: 0.5,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
initial_energy_gain: 0,
|
||||||
|
max_energy_gain: 0,
|
||||||
|
energy_increase: 0,
|
||||||
|
speed_increase: 0.0,
|
||||||
|
max_speed_increase: 0.0,
|
||||||
|
scales_from_combo: 0,
|
||||||
|
is_interruptible: false,
|
||||||
|
)
|
53
assets/common/abilities/unique/husk/triplestrike.ron
Normal file
53
assets/common/abilities/unique/husk/triplestrike.ron
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
ComboMelee(
|
||||||
|
stage_data: [
|
||||||
|
(
|
||||||
|
stage: 1,
|
||||||
|
base_damage: 120,
|
||||||
|
damage_increase: 0,
|
||||||
|
base_poise_damage: 35,
|
||||||
|
poise_damage_increase: 0,
|
||||||
|
knockback: 5.0,
|
||||||
|
range: 3.5,
|
||||||
|
angle: 30.0,
|
||||||
|
base_buildup_duration: 0.2,
|
||||||
|
base_swing_duration: 0.07,
|
||||||
|
base_recover_duration: 0.2,
|
||||||
|
forward_movement: 1.0,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
stage: 2,
|
||||||
|
base_damage: 120,
|
||||||
|
damage_increase: 0,
|
||||||
|
base_poise_damage: 35,
|
||||||
|
poise_damage_increase: 0,
|
||||||
|
knockback: 5.0,
|
||||||
|
range: 3.5,
|
||||||
|
angle: 30.0,
|
||||||
|
base_buildup_duration: 0.22,
|
||||||
|
base_swing_duration: 0.07,
|
||||||
|
base_recover_duration: 0.2,
|
||||||
|
forward_movement: 0.0,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
stage: 3,
|
||||||
|
base_damage: 120,
|
||||||
|
damage_increase: 0,
|
||||||
|
base_poise_damage: 35,
|
||||||
|
poise_damage_increase: 0,
|
||||||
|
knockback: 5.0,
|
||||||
|
range: 3.5,
|
||||||
|
angle: 30.0,
|
||||||
|
base_buildup_duration: 0.2,
|
||||||
|
base_swing_duration: 0.07,
|
||||||
|
base_recover_duration: 0.2,
|
||||||
|
forward_movement: 1.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
initial_energy_gain: 0,
|
||||||
|
max_energy_gain: 0,
|
||||||
|
energy_increase: 0,
|
||||||
|
speed_increase: 0.0,
|
||||||
|
max_speed_increase: 0.0,
|
||||||
|
scales_from_combo: 0,
|
||||||
|
is_interruptible: false,
|
||||||
|
)
|
@ -29,6 +29,11 @@
|
|||||||
(Some(Bow(UnlockRepeater)), "common.abilities.bow.repeater"),
|
(Some(Bow(UnlockRepeater)), "common.abilities.bow.repeater"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Unique(Husk): (
|
||||||
|
primary: "common.abilities.unique.husk.singlestrike",
|
||||||
|
secondary: "common.abilities.unique.husk.triplestrike",
|
||||||
|
abilities: [],
|
||||||
|
),
|
||||||
Spear: (
|
Spear: (
|
||||||
primary: "common.abilities.spear.doublestrike",
|
primary: "common.abilities.spear.doublestrike",
|
||||||
secondary: "common.abilities.spear.dash",
|
secondary: "common.abilities.spear.dash",
|
||||||
|
18
assets/common/items/npc_weapons/unique/husk.ron
Normal file
18
assets/common/items/npc_weapons/unique/husk.ron
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
ItemDef(
|
||||||
|
name: "Husk",
|
||||||
|
description: "testing123",
|
||||||
|
kind: Tool((
|
||||||
|
kind: Unique(Husk),
|
||||||
|
hands: Two,
|
||||||
|
stats: Direct((
|
||||||
|
equip_time_secs: 0.01,
|
||||||
|
power: 1.0,
|
||||||
|
poise_strength: 1.0,
|
||||||
|
speed: 1.0,
|
||||||
|
crit_chance: 0.0625,
|
||||||
|
crit_mult: 1.9142857,
|
||||||
|
)),
|
||||||
|
)),
|
||||||
|
quality: Low,
|
||||||
|
tags: [],
|
||||||
|
)
|
@ -478,7 +478,7 @@
|
|||||||
central: ("npc.mindflayer.male.torso_upper"),
|
central: ("npc.mindflayer.male.torso_upper"),
|
||||||
),
|
),
|
||||||
torso_lower: (
|
torso_lower: (
|
||||||
offset: (-12.5, -10.0, -9.0),
|
offset: (-12.5, -10.0, -18.0),
|
||||||
central: ("npc.mindflayer.male.torso_lower"),
|
central: ("npc.mindflayer.male.torso_lower"),
|
||||||
),
|
),
|
||||||
jaw: (
|
jaw: (
|
||||||
@ -504,7 +504,7 @@
|
|||||||
central: ("npc.mindflayer.male.torso_upper"),
|
central: ("npc.mindflayer.male.torso_upper"),
|
||||||
),
|
),
|
||||||
torso_lower: (
|
torso_lower: (
|
||||||
offset: (-12.5, -10.0, -9.0),
|
offset: (-12.5, -10.0, -18.0),
|
||||||
central: ("npc.mindflayer.male.torso_lower"),
|
central: ("npc.mindflayer.male.torso_lower"),
|
||||||
),
|
),
|
||||||
jaw: (
|
jaw: (
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
vox_spec: ("npc.myrmidon.male.pants", (-2.5, -4.5, -1.5)),
|
vox_spec: ("npc.myrmidon.male.pants", (-2.5, -4.5, -1.5)),
|
||||||
),
|
),
|
||||||
"Husk": (
|
"Husk": (
|
||||||
vox_spec: ("npc.husk.male.pants", (-5.0, -4.5, -3.0)),
|
vox_spec: ("npc.husk.male.pants", (-5.0, -4.5, -6.0)),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
@ -969,7 +969,7 @@
|
|||||||
vox_spec: ("armor.empty", (-3.0, -3.5, 1.0)),
|
vox_spec: ("armor.empty", (-3.0, -3.5, 1.0)),
|
||||||
color: None
|
color: None
|
||||||
),
|
),
|
||||||
"common.items.npc_weapons.unique.quadmedbasic": (
|
"common.items.npc_weapons.unique.husk": (
|
||||||
vox_spec: ("armor.empty", (-3.0, -3.5, 1.0)),
|
vox_spec: ("armor.empty", (-3.0, -3.5, 1.0)),
|
||||||
color: None
|
color: None
|
||||||
),
|
),
|
||||||
|
@ -406,6 +406,7 @@ impl assets::Compound for AbilityMap {
|
|||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
pub enum UniqueKind {
|
pub enum UniqueKind {
|
||||||
StoneGolemFist,
|
StoneGolemFist,
|
||||||
|
Husk,
|
||||||
BeastClaws,
|
BeastClaws,
|
||||||
WendigoMagic,
|
WendigoMagic,
|
||||||
TidalClaws,
|
TidalClaws,
|
||||||
|
@ -311,7 +311,7 @@ impl LoadoutBuilder {
|
|||||||
},
|
},
|
||||||
(biped_small::Species::Husk, _) => {
|
(biped_small::Species::Husk, _) => {
|
||||||
main_tool = Some(Item::new_from_asset_expect(
|
main_tool = Some(Item::new_from_asset_expect(
|
||||||
"common.items.npc_weapons.unique.quadmedbasic",
|
"common.items.npc_weapons.unique.husk",
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -76,8 +76,8 @@ impl Animation for AlphaAnimation {
|
|||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip.0);
|
||||||
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip.0);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
@ -90,8 +90,8 @@ impl Animation for AlphaAnimation {
|
|||||||
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
-3.0 + move1 * -4.0 + move2 * 5.0,
|
-3.0 + move1 * -4.0 + move2 * 5.0,
|
||||||
5.0 + s_a.grip / 1.2 + move1 * -4.0 + move2 * 8.0,
|
5.0 + s_a.grip.0 / 1.2 + move1 * -4.0 + move2 * 8.0,
|
||||||
-4.0 + -s_a.grip / 2.0 + move2 * -5.0,
|
-4.0 + -s_a.grip.0 / 2.0 + move2 * -5.0,
|
||||||
);
|
);
|
||||||
next.upper_torso.orientation = Quaternion::rotation_z(move1 * 0.5 + move2 * -0.7);
|
next.upper_torso.orientation = Quaternion::rotation_z(move1 * 0.5 + move2 * -0.7);
|
||||||
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.7);
|
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.7);
|
||||||
@ -113,8 +113,8 @@ impl Animation for AlphaAnimation {
|
|||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
4.0 + move1 * -12.0 + move2 * 20.0,
|
4.0 + move1 * -12.0 + move2 * 20.0,
|
||||||
(s_a.grip / 1.0) + move1 * -3.0 + move2 * 5.0,
|
(s_a.grip.0 / 1.0) + move1 * -3.0 + move2 * 5.0,
|
||||||
(-s_a.grip / 0.8) + move1 * -2.0 + move2 * 8.0,
|
(-s_a.grip.0 / 0.8) + move1 * -2.0 + move2 * 8.0,
|
||||||
);
|
);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
|
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
|
||||||
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
||||||
@ -138,8 +138,8 @@ impl Animation for AlphaAnimation {
|
|||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
4.0 + move1 * -12.0 + move2 * 28.0,
|
4.0 + move1 * -12.0 + move2 * 28.0,
|
||||||
(s_a.grip / 1.0) + move1 * -3.0 + move2 * -5.0,
|
(s_a.grip.0 / 1.0) + move1 * -3.0 + move2 * -5.0,
|
||||||
(-s_a.grip / 0.8) + move1 * 2.0 + move2 * 8.0,
|
(-s_a.grip.0 / 0.8) + move1 * 2.0 + move2 * 8.0,
|
||||||
);
|
);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
|
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
|
||||||
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
||||||
|
@ -2,7 +2,10 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
use common::{
|
||||||
|
comp::item::{ToolKind, UniqueKind},
|
||||||
|
states::utils::StageSection,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
pub struct BeamAnimation;
|
pub struct BeamAnimation;
|
||||||
@ -53,23 +56,25 @@ impl Animation for BeamAnimation {
|
|||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
match active_tool_kind {
|
match active_tool_kind {
|
||||||
Some(ToolKind::StaffSimple) | Some(ToolKind::Sceptre) => {
|
Some(ToolKind::StaffSimple)
|
||||||
|
| Some(ToolKind::Sceptre)
|
||||||
|
| Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => {
|
||||||
let (move1base, move2shake, _move2base, move3) = match stage_section {
|
let (move1base, move2shake, _move2base, move3) = match stage_section {
|
||||||
Some(StageSection::Buildup) => (
|
Some(StageSection::Buildup) => (
|
||||||
(anim_time.powf(0.25)).min(1.0),
|
(anim_time.powf(0.25)).min(1.0),
|
||||||
(anim_time * 10.0 + PI).sin(),
|
(anim_time * 15.0 + PI).sin(),
|
||||||
(anim_time * 10.0 + PI).sin(),
|
(anim_time * 10.0 + PI).sin(),
|
||||||
0.0,
|
0.0,
|
||||||
),
|
),
|
||||||
Some(StageSection::Cast) => (
|
Some(StageSection::Cast) => (
|
||||||
1.0,
|
1.0,
|
||||||
(anim_time * 10.0 + PI).sin(),
|
(anim_time * 15.0 + PI).sin(),
|
||||||
anim_time.powf(0.25),
|
anim_time.powf(0.25),
|
||||||
0.0,
|
0.0,
|
||||||
),
|
),
|
||||||
@ -80,14 +85,15 @@ impl Animation for BeamAnimation {
|
|||||||
let move1 = move1base * pullback;
|
let move1 = move1base * pullback;
|
||||||
next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
|
next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
|
||||||
next.control_r.position =
|
next.control_r.position =
|
||||||
Vec3::new(1.0 + move1 * 5.0, 2.0 + move1 * 1.0, 2.0 + move1 * 8.0);
|
Vec3::new(1.0 + move1 * 5.0, 2.0 + move1 * 1.0, 2.0 + move1 * 14.0);
|
||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
-3.0 + move1 * 5.0,
|
-3.0 + move1 * -5.0,
|
||||||
3.0 + s_a.grip / 1.2 + move1 * 5.0 + move2shake * 1.0,
|
3.0 + s_a.grip.0 / 1.2 + move1 * 3.0 + move2shake * 1.0,
|
||||||
-11.0 + -s_a.grip / 2.0 + move1 * -4.0,
|
-11.0 + -s_a.grip.0 / 2.0 + move1 * -2.0,
|
||||||
);
|
);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * -0.2);
|
next.head.orientation =
|
||||||
|
Quaternion::rotation_x(move1 * -0.2) * Quaternion::rotation_y(move1 * 0.2);
|
||||||
next.jaw.orientation = Quaternion::rotation_x(0.0);
|
next.jaw.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
@ -96,8 +102,8 @@ impl Animation for BeamAnimation {
|
|||||||
* Quaternion::rotation_y(0.5)
|
* Quaternion::rotation_y(0.5)
|
||||||
* Quaternion::rotation_z(move1 * 1.2 + move2shake * 0.5);
|
* Quaternion::rotation_z(move1 * 1.2 + move2shake * 0.5);
|
||||||
|
|
||||||
next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * -0.2)
|
next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * -0.1)
|
||||||
* Quaternion::rotation_y(-0.1 + move1 * -0.4);
|
* Quaternion::rotation_y(-0.1 + move1 * 0.6);
|
||||||
next.shoulder_l.position = Vec3::new(
|
next.shoulder_l.position = Vec3::new(
|
||||||
-s_a.shoulder.0,
|
-s_a.shoulder.0,
|
||||||
s_a.shoulder.1,
|
s_a.shoulder.1,
|
||||||
|
@ -75,8 +75,8 @@ impl Animation for BetaAnimation {
|
|||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip.0);
|
||||||
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip.0);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
@ -89,8 +89,8 @@ impl Animation for BetaAnimation {
|
|||||||
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
-3.0 + move1 * -4.0 + move2 * 5.0,
|
-3.0 + move1 * -4.0 + move2 * 5.0,
|
||||||
5.0 + s_a.grip / 1.2 + move1 * -4.0 + move2 * 8.0,
|
5.0 + s_a.grip.0 / 1.2 + move1 * -4.0 + move2 * 8.0,
|
||||||
-4.0 + -s_a.grip / 2.0 + move2 * -5.0,
|
-4.0 + -s_a.grip.0 / 2.0 + move2 * -5.0,
|
||||||
);
|
);
|
||||||
next.upper_torso.orientation =
|
next.upper_torso.orientation =
|
||||||
Quaternion::rotation_z(move1base * 0.5 + move2 * -0.7);
|
Quaternion::rotation_z(move1base * 0.5 + move2 * -0.7);
|
||||||
@ -114,8 +114,8 @@ impl Animation for BetaAnimation {
|
|||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
4.0 + move1 * -12.0 + move2 * 20.0,
|
4.0 + move1 * -12.0 + move2 * 20.0,
|
||||||
(s_a.grip / 1.0) + move1 * -3.0 + move2 * 5.0,
|
(s_a.grip.0 / 1.0) + move1 * -3.0 + move2 * 5.0,
|
||||||
(-s_a.grip / 0.8) + move1 * 6.0 + move2 * 8.0,
|
(-s_a.grip.0 / 0.8) + move1 * 6.0 + move2 * 8.0,
|
||||||
);
|
);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
|
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
|
||||||
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
||||||
@ -139,8 +139,8 @@ impl Animation for BetaAnimation {
|
|||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
4.0 + move1 * -18.0 + move2 * 20.0,
|
4.0 + move1 * -18.0 + move2 * 20.0,
|
||||||
(s_a.grip / 1.0) + move1 * -3.0 + move2 * 12.0,
|
(s_a.grip.0 / 1.0) + move1 * -3.0 + move2 * 12.0,
|
||||||
(-s_a.grip / 0.8) + move1 * -2.0 + move2 * 4.0,
|
(-s_a.grip.0 / 0.8) + move1 * -2.0 + move2 * 4.0,
|
||||||
);
|
);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
|
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
|
||||||
* Quaternion::rotation_z(move1 * -0.9 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.9 + move2 * 0.6);
|
||||||
|
112
voxygen/anim/src/biped_large/blink.rs
Normal file
112
voxygen/anim/src/biped_large/blink.rs
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
|
use common::{
|
||||||
|
comp::item::{ToolKind, UniqueKind},
|
||||||
|
states::utils::StageSection,
|
||||||
|
};
|
||||||
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
|
pub struct BlinkAnimation;
|
||||||
|
|
||||||
|
impl Animation for BlinkAnimation {
|
||||||
|
type Dependency = (
|
||||||
|
Option<ToolKind>,
|
||||||
|
Option<ToolKind>,
|
||||||
|
Vec3<f32>,
|
||||||
|
f32,
|
||||||
|
Option<StageSection>,
|
||||||
|
f32,
|
||||||
|
);
|
||||||
|
type Skeleton = BipedLargeSkeleton;
|
||||||
|
|
||||||
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const UPDATE_FN: &'static [u8] = b"biped_large_blink\0";
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_blink")]
|
||||||
|
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||||
|
fn update_skeleton_inner(
|
||||||
|
skeleton: &Self::Skeleton,
|
||||||
|
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency,
|
||||||
|
anim_time: f32,
|
||||||
|
rate: &mut f32,
|
||||||
|
s_a: &SkeletonAttr,
|
||||||
|
) -> Self::Skeleton {
|
||||||
|
*rate = 1.0;
|
||||||
|
let mut next = (*skeleton).clone();
|
||||||
|
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||||
|
|
||||||
|
let lab: f32 = 0.65 * s_a.tempo;
|
||||||
|
let speednorm = (speed / 12.0).powf(0.4);
|
||||||
|
let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm;
|
||||||
|
let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm;
|
||||||
|
let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt())
|
||||||
|
* ((acc_vel * lab + PI * 1.4).sin());
|
||||||
|
|
||||||
|
let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt())
|
||||||
|
* ((acc_vel * lab + PI * 0.4).sin());
|
||||||
|
let (move1base, move2) = match stage_section {
|
||||||
|
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0),
|
||||||
|
Some(StageSection::Recover) => (1.0, anim_time.powi(4)),
|
||||||
|
_ => (0.0, 0.0),
|
||||||
|
};
|
||||||
|
let pullback = 1.0 - move2;
|
||||||
|
let move1 = move1base * pullback;
|
||||||
|
|
||||||
|
next.shoulder_l.position = Vec3::new(
|
||||||
|
-s_a.shoulder.0,
|
||||||
|
s_a.shoulder.1,
|
||||||
|
s_a.shoulder.2 - foothorir * 1.0,
|
||||||
|
);
|
||||||
|
next.shoulder_l.orientation =
|
||||||
|
Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotr * -0.2) * speednorm);
|
||||||
|
|
||||||
|
next.shoulder_r.position = Vec3::new(
|
||||||
|
s_a.shoulder.0,
|
||||||
|
s_a.shoulder.1,
|
||||||
|
s_a.shoulder.2 - foothoril * 1.0,
|
||||||
|
);
|
||||||
|
next.shoulder_r.orientation =
|
||||||
|
Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2) * speednorm);
|
||||||
|
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
|
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
|
next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
|
|
||||||
|
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
match active_tool_kind {
|
||||||
|
Some(ToolKind::StaffSimple) | Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => {
|
||||||
|
next.head.orientation =
|
||||||
|
Quaternion::rotation_x(move1 * -0.3) * Quaternion::rotation_y(move1 * -0.1);
|
||||||
|
next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
|
||||||
|
next.control_r.position =
|
||||||
|
Vec3::new(1.0 + move1 * 12.0, 2.0 + move1 * 8.0, 2.0 + move1 * 18.0);
|
||||||
|
|
||||||
|
next.control.position = Vec3::new(
|
||||||
|
-3.0 + move1 * -4.0,
|
||||||
|
3.0 + s_a.grip.0 / 1.2 + move1 * -8.0,
|
||||||
|
-11.0 + -s_a.grip.0 / 2.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 - move1 * -0.8)
|
||||||
|
* Quaternion::rotation_y(-0.5 + move1 * -0.0)
|
||||||
|
* Quaternion::rotation_z(move1 * 0.0);
|
||||||
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.7)
|
||||||
|
* Quaternion::rotation_y(0.5 + move1 * -0.6)
|
||||||
|
* Quaternion::rotation_z(move1 * 1.5);
|
||||||
|
|
||||||
|
next.control.orientation =
|
||||||
|
Quaternion::rotation_x(-0.2 + move1 * -0.4) * Quaternion::rotation_y(-0.1);
|
||||||
|
},
|
||||||
|
|
||||||
|
_ => {},
|
||||||
|
}
|
||||||
|
next
|
||||||
|
}
|
||||||
|
}
|
@ -47,8 +47,8 @@ impl Animation for DashAnimation {
|
|||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip.0);
|
||||||
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip.0);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
@ -88,8 +88,8 @@ impl Animation for DashAnimation {
|
|||||||
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
-3.0 + move1 * -2.0 + move2 * 2.0,
|
-3.0 + move1 * -2.0 + move2 * 2.0,
|
||||||
5.0 + s_a.grip / 1.2 + move1 * -4.0 + move2 * 2.0 + move3 * 8.0,
|
5.0 + s_a.grip.0 / 1.2 + move1 * -4.0 + move2 * 2.0 + move3 * 8.0,
|
||||||
-4.0 + -s_a.grip / 2.0 + move2 * -5.0 + move3 * 5.0,
|
-4.0 + -s_a.grip.0 / 2.0 + move2 * -5.0 + move3 * 5.0,
|
||||||
);
|
);
|
||||||
next.upper_torso.orientation = Quaternion::rotation_x(move2 * -0.2 + move3 * 0.2)
|
next.upper_torso.orientation = Quaternion::rotation_x(move2 * -0.2 + move3 * 0.2)
|
||||||
* Quaternion::rotation_z(move1 * 0.8 + move3 * -0.7);
|
* Quaternion::rotation_z(move1 * 0.8 + move3 * -0.7);
|
||||||
@ -114,8 +114,8 @@ impl Animation for DashAnimation {
|
|||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
4.0 + move1 * -3.0 + move3 * -5.0,
|
4.0 + move1 * -3.0 + move3 * -5.0,
|
||||||
(s_a.grip / 1.0) + move1 * -1.0 + move3 * 1.0 + footrotl * 2.0,
|
(s_a.grip.0 / 1.0) + move1 * -1.0 + move3 * 1.0 + footrotl * 2.0,
|
||||||
(-s_a.grip / 0.8) + move1 * 2.0 + move3 * -3.0,
|
(-s_a.grip.0 / 0.8) + move1 * 2.0 + move3 * -3.0,
|
||||||
);
|
);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * -0.5 + move3 * 0.5)
|
next.head.orientation = Quaternion::rotation_x(move1 * -0.5 + move3 * 0.5)
|
||||||
* Quaternion::rotation_z(move1 * 0.3 + move3 * 0.3);
|
* Quaternion::rotation_z(move1 * 0.3 + move3 * 0.3);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
pub mod alpha;
|
pub mod alpha;
|
||||||
pub mod beam;
|
pub mod beam;
|
||||||
pub mod beta;
|
pub mod beta;
|
||||||
|
pub mod blink;
|
||||||
pub mod charge;
|
pub mod charge;
|
||||||
pub mod dash;
|
pub mod dash;
|
||||||
pub mod equip;
|
pub mod equip;
|
||||||
@ -12,15 +13,16 @@ pub mod shockwave;
|
|||||||
pub mod shoot;
|
pub mod shoot;
|
||||||
pub mod spin;
|
pub mod spin;
|
||||||
pub mod spinmelee;
|
pub mod spinmelee;
|
||||||
|
pub mod summon;
|
||||||
pub mod wield;
|
pub mod wield;
|
||||||
|
|
||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{
|
pub use self::{
|
||||||
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, charge::ChargeAnimation,
|
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, blink::BlinkAnimation,
|
||||||
dash::DashAnimation, equip::EquipAnimation, idle::IdleAnimation, jump::JumpAnimation,
|
charge::ChargeAnimation, dash::DashAnimation, equip::EquipAnimation, idle::IdleAnimation,
|
||||||
leapmelee::LeapAnimation, run::RunAnimation, shockwave::ShockwaveAnimation,
|
jump::JumpAnimation, leapmelee::LeapAnimation, run::RunAnimation,
|
||||||
shoot::ShootAnimation, spin::SpinAnimation, spinmelee::SpinMeleeAnimation,
|
shockwave::ShockwaveAnimation, shoot::ShootAnimation, spin::SpinAnimation,
|
||||||
wield::WieldAnimation,
|
spinmelee::SpinMeleeAnimation, summon::SummonAnimation, wield::WieldAnimation,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||||
@ -127,7 +129,7 @@ pub struct SkeletonAttr {
|
|||||||
foot: (f32, f32, f32),
|
foot: (f32, f32, f32),
|
||||||
scaler: f32,
|
scaler: f32,
|
||||||
tempo: f32,
|
tempo: f32,
|
||||||
grip: f32,
|
grip: (f32, f32),
|
||||||
shl: (f32, f32, f32, f32, f32, f32),
|
shl: (f32, f32, f32, f32, f32, f32),
|
||||||
shr: (f32, f32, f32, f32, f32, f32),
|
shr: (f32, f32, f32, f32, f32, f32),
|
||||||
sc: (f32, f32, f32, f32, f32, f32),
|
sc: (f32, f32, f32, f32, f32, f32),
|
||||||
@ -169,7 +171,7 @@ impl Default for SkeletonAttr {
|
|||||||
foot: (0.0, 0.0, 0.0),
|
foot: (0.0, 0.0, 0.0),
|
||||||
scaler: 0.0,
|
scaler: 0.0,
|
||||||
tempo: 0.0,
|
tempo: 0.0,
|
||||||
grip: 0.0,
|
grip: (0.0, 0.0),
|
||||||
shl: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
|
shl: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
|
||||||
shr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
|
shr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
|
||||||
sc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
|
sc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
|
||||||
@ -259,7 +261,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
|||||||
(Occultsaurok, _) => (0.0, -5.0),
|
(Occultsaurok, _) => (0.0, -5.0),
|
||||||
(Mightysaurok, _) => (0.0, -5.0),
|
(Mightysaurok, _) => (0.0, -5.0),
|
||||||
(Slysaurok, _) => (0.0, -6.0),
|
(Slysaurok, _) => (0.0, -6.0),
|
||||||
(Mindflayer, _) => (3.5, -19.5),
|
(Mindflayer, _) => (3.5, -10.0),
|
||||||
(Minotaur, _) => (1.5, -8.5),
|
(Minotaur, _) => (1.5, -8.5),
|
||||||
(Tidalwarrior, _) => (0.0, -9.5),
|
(Tidalwarrior, _) => (0.0, -9.5),
|
||||||
(Yeti, _) => (0.0, -6.5),
|
(Yeti, _) => (0.0, -6.5),
|
||||||
@ -343,7 +345,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
|||||||
(Occultsaurok, _) => (3.5, 3.5, -10.0),
|
(Occultsaurok, _) => (3.5, 3.5, -10.0),
|
||||||
(Mightysaurok, _) => (3.5, 3.5, -10.0),
|
(Mightysaurok, _) => (3.5, 3.5, -10.0),
|
||||||
(Slysaurok, _) => (3.5, 3.5, -10.0),
|
(Slysaurok, _) => (3.5, 3.5, -10.0),
|
||||||
(Mindflayer, _) => (4.5, 1.5, -7.0),
|
(Mindflayer, _) => (4.5, 1.5, -16.0),
|
||||||
(Minotaur, _) => (6.0, 4.5, -17.5),
|
(Minotaur, _) => (6.0, 4.5, -17.5),
|
||||||
(Tidalwarrior, _) => (3.5, 0.5, -10.5),
|
(Tidalwarrior, _) => (3.5, 0.5, -10.5),
|
||||||
(Yeti, _) => (4.5, 0.5, -12.5),
|
(Yeti, _) => (4.5, 0.5, -12.5),
|
||||||
@ -380,23 +382,23 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
|||||||
_ => 1.0,
|
_ => 1.0,
|
||||||
},
|
},
|
||||||
grip: match (body.species, body.body_type) {
|
grip: match (body.species, body.body_type) {
|
||||||
(Ogre, Male) => 13.0,
|
(Ogre, Male) => (13.0, 0.0),
|
||||||
(Ogre, Female) => 8.0,
|
(Ogre, Female) => (8.0, 0.0),
|
||||||
(Cyclops, _) => 12.0,
|
(Cyclops, _) => (12.0, 0.0),
|
||||||
(Wendigo, _) => 15.0,
|
(Wendigo, _) => (15.0, 0.0),
|
||||||
(Troll, _) => 12.0,
|
(Troll, _) => (12.0, 0.0),
|
||||||
(Dullahan, _) => 15.0,
|
(Dullahan, _) => (15.0, 0.0),
|
||||||
(Werewolf, _) => 13.0,
|
(Werewolf, _) => (13.0, 0.0),
|
||||||
(Occultsaurok, _) => 10.0,
|
(Occultsaurok, _) => (10.0, 0.0),
|
||||||
(Mightysaurok, _) => 10.0,
|
(Mightysaurok, _) => (10.0, 0.0),
|
||||||
(Slysaurok, _) => 10.0,
|
(Slysaurok, _) => (10.0, 0.0),
|
||||||
(Mindflayer, _) => 12.0,
|
(Mindflayer, _) => (12.0, 2.5),
|
||||||
(Minotaur, _) => 14.0,
|
(Minotaur, _) => (14.0, 0.0),
|
||||||
(Tidalwarrior, _) => 14.0,
|
(Tidalwarrior, _) => (14.0, 0.0),
|
||||||
(Yeti, _) => 12.5,
|
(Yeti, _) => (12.5, 0.0),
|
||||||
(Harvester, _) => 7.5,
|
(Harvester, _) => (7.5, 0.0),
|
||||||
(Blueoni, _) => 12.5,
|
(Blueoni, _) => (12.5, 0.0),
|
||||||
(Redoni, _) => 12.5,
|
(Redoni, _) => (12.5, 0.0),
|
||||||
},
|
},
|
||||||
shl: match (body.species, body.body_type) {
|
shl: match (body.species, body.body_type) {
|
||||||
(Dullahan, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0),
|
(Dullahan, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0),
|
||||||
|
@ -82,8 +82,8 @@ impl Animation for ShootAnimation {
|
|||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip.0);
|
||||||
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip.0);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
@ -105,8 +105,8 @@ impl Animation for ShootAnimation {
|
|||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
-3.0,
|
-3.0,
|
||||||
3.0 + s_a.grip / 1.2 + move1 * 4.0 + move2 + move1shake * 2.0 + move2 * -2.0,
|
3.0 + s_a.grip.0 / 1.2 + move1 * 4.0 + move2 + move1shake * 2.0 + move2 * -2.0,
|
||||||
-11.0 + -s_a.grip / 2.0 + move1 * 3.0,
|
-11.0 + -s_a.grip.0 / 2.0 + move1 * 3.0,
|
||||||
);
|
);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1 * -0.15)
|
next.head.orientation = Quaternion::rotation_x(move1 * -0.15)
|
||||||
* Quaternion::rotation_y(move1 * 0.25)
|
* Quaternion::rotation_y(move1 * 0.25)
|
||||||
@ -154,8 +154,8 @@ impl Animation for ShootAnimation {
|
|||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
-1.0 + move1 * 2.0,
|
-1.0 + move1 * 2.0,
|
||||||
6.0 + s_a.grip / 1.2 + move1 * 7.0,
|
6.0 + s_a.grip.0 / 1.2 + move1 * 7.0,
|
||||||
-5.0 + -s_a.grip / 2.0 + move1 * 8.0,
|
-5.0 + -s_a.grip.0 / 2.0 + move1 * 8.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
|
@ -2,7 +2,10 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BipedLargeSkeleton, SkeletonAttr,
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
use common::{
|
||||||
|
comp::item::{ToolKind, UniqueKind},
|
||||||
|
states::utils::StageSection,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
pub struct SpinMeleeAnimation;
|
pub struct SpinMeleeAnimation;
|
||||||
@ -14,6 +17,7 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
Vec3<f32>,
|
Vec3<f32>,
|
||||||
f32,
|
f32,
|
||||||
Option<StageSection>,
|
Option<StageSection>,
|
||||||
|
f32,
|
||||||
);
|
);
|
||||||
type Skeleton = BipedLargeSkeleton;
|
type Skeleton = BipedLargeSkeleton;
|
||||||
|
|
||||||
@ -24,122 +28,97 @@ impl Animation for SpinMeleeAnimation {
|
|||||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||||
fn update_skeleton_inner(
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section): Self::Dependency,
|
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency,
|
||||||
anim_time: f32,
|
anim_time: f32,
|
||||||
rate: &mut f32,
|
rate: &mut f32,
|
||||||
s_a: &SkeletonAttr,
|
s_a: &SkeletonAttr,
|
||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
*rate = 1.0;
|
*rate = 1.0;
|
||||||
let lab: f32 = 1.0;
|
let mut next = (*skeleton).clone();
|
||||||
let (_movement1, movement2, movement3) = match stage_section {
|
|
||||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||||
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
|
|
||||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
let lab: f32 = 0.65 * s_a.tempo;
|
||||||
|
let speednorm = (speed / 12.0).powf(0.4);
|
||||||
|
let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm;
|
||||||
|
let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm;
|
||||||
|
let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt())
|
||||||
|
* ((acc_vel * lab + PI * 1.4).sin());
|
||||||
|
|
||||||
|
let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt())
|
||||||
|
* ((acc_vel * lab + PI * 0.4).sin());
|
||||||
|
|
||||||
|
let (move1base, move2, move3) = match stage_section {
|
||||||
|
Some(StageSection::Buildup) => ((anim_time.powf(0.25)), 0.0, 0.0),
|
||||||
|
Some(StageSection::Swing) => (1.0, (anim_time * 0.05).sin() - 0.05, 0.0),
|
||||||
|
Some(StageSection::Recover) => (1.0, 0.0, anim_time),
|
||||||
_ => (0.0, 0.0, 0.0),
|
_ => (0.0, 0.0, 0.0),
|
||||||
};
|
};
|
||||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
let pullback = 1.0 - move3;
|
||||||
let mut next = (*skeleton).clone();
|
let move1 = move1base * pullback;
|
||||||
//torso movement
|
|
||||||
let xshift = if velocity.z.abs() < 0.1 {
|
|
||||||
((anim_time - 1.1) * lab * 3.0).sin()
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
let yshift = if velocity.z.abs() < 0.1 {
|
|
||||||
((anim_time - 1.1) * lab * 3.0 + PI / 2.0).sin()
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
};
|
|
||||||
|
|
||||||
let spin = if anim_time < 1.1 && velocity.z.abs() < 0.1 {
|
next.shoulder_l.position = Vec3::new(
|
||||||
0.5 * (anim_time.powi(2))
|
-s_a.shoulder.0,
|
||||||
} else {
|
s_a.shoulder.1,
|
||||||
lab * anim_time * 0.9
|
s_a.shoulder.2 - foothorir * 1.0,
|
||||||
};
|
);
|
||||||
|
next.shoulder_l.orientation =
|
||||||
|
Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotr * -0.2) * speednorm);
|
||||||
|
|
||||||
//feet
|
next.shoulder_r.position = Vec3::new(
|
||||||
let slowersmooth = (anim_time * lab * 4.0).sin();
|
s_a.shoulder.0,
|
||||||
let quick = (anim_time * lab * 8.0).sin();
|
s_a.shoulder.1,
|
||||||
|
s_a.shoulder.2 - foothoril * 1.0,
|
||||||
|
);
|
||||||
|
next.shoulder_r.orientation =
|
||||||
|
Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2) * speednorm);
|
||||||
|
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
match active_tool_kind {
|
|
||||||
Some(ToolKind::Sword) => {
|
|
||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
|
next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
next.hand_l.orientation =
|
next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
|
|
||||||
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
|
|
||||||
next.hand_r.orientation =
|
|
||||||
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
|
|
||||||
|
|
||||||
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
|
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
next.control.orientation =
|
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
Quaternion::rotation_x(s_a.sc.3 - PI / 2.0 + movement3 * PI / 2.0)
|
|
||||||
* Quaternion::rotation_z(s_a.sc.5 - PI / 2.0 + movement3 * PI / 2.0);
|
|
||||||
next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0);
|
|
||||||
|
|
||||||
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
|
match active_tool_kind {
|
||||||
next.upper_torso.orientation = Quaternion::rotation_y(0.3 + movement3 * -0.3);
|
Some(ToolKind::StaffSimple) | Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => {
|
||||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
next.head.orientation = Quaternion::rotation_x(move1 * -0.3 + move2 * 0.5);
|
||||||
next.head.orientation = Quaternion::rotation_x(-0.15 + movement3 * 0.15);
|
next.control_l.position = Vec3::new(
|
||||||
next.lower_torso.orientation = Quaternion::rotation_x(0.2);
|
-1.0 + move1 * -10.0 + move2 * -10.0,
|
||||||
},
|
3.0,
|
||||||
Some(ToolKind::Axe) => {
|
12.0 + move1 * 7.0,
|
||||||
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
|
);
|
||||||
next.hand_l.orientation =
|
next.control_r.position = Vec3::new(
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(PI);
|
1.0 + move1 * 10.0 + move2 * -10.0,
|
||||||
next.hand_r.position = Vec3::new(0.5, 0.0, -2.5);
|
2.0 + move1 * -0.0,
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
|
2.0 + move1 * 15.0,
|
||||||
next.main.position = Vec3::new(-0.0, -2.0, -1.0);
|
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
|
||||||
|
|
||||||
next.control.position = Vec3::new(0.0, 16.0, 3.0);
|
|
||||||
next.control.orientation =
|
|
||||||
Quaternion::rotation_x(-1.4) * Quaternion::rotation_z(1.4);
|
|
||||||
|
|
||||||
next.head.orientation =
|
|
||||||
Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(0.08);
|
|
||||||
next.upper_torso.position =
|
|
||||||
Vec3::new(0.0, s_a.upper_torso.0 - 3.0, s_a.upper_torso.1 - 2.0);
|
|
||||||
next.upper_torso.orientation = Quaternion::rotation_z(0.0)
|
|
||||||
* Quaternion::rotation_x(-0.1)
|
|
||||||
* Quaternion::rotation_y(0.3);
|
|
||||||
|
|
||||||
next.lower_torso.position = Vec3::new(0.0, 3.0, -2.5);
|
|
||||||
next.lower_torso.orientation = Quaternion::rotation_z(0.0)
|
|
||||||
* Quaternion::rotation_x(0.7)
|
|
||||||
* Quaternion::rotation_y(0.0);
|
|
||||||
next.torso.position = Vec3::new(
|
|
||||||
-xshift * anim_time.min(0.6),
|
|
||||||
-yshift * anim_time.min(0.6),
|
|
||||||
0.0,
|
|
||||||
);
|
);
|
||||||
next.torso.orientation = Quaternion::rotation_z(spin * -16.0)
|
|
||||||
* Quaternion::rotation_x(0.0)
|
|
||||||
* Quaternion::rotation_y(0.0);
|
|
||||||
if velocity.z.abs() > 0.1 {
|
|
||||||
next.foot_l.position = Vec3::new(-s_a.foot.0, 8.0, s_a.foot.2 + 2.0);
|
|
||||||
next.foot_l.orientation =
|
|
||||||
Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0);
|
|
||||||
|
|
||||||
next.foot_r.position = Vec3::new(s_a.foot.0, 8.0, s_a.foot.2 + 2.0);
|
next.control.position = Vec3::new(
|
||||||
next.foot_r.orientation = Quaternion::rotation_x(1.0);
|
-3.0 + move1 * 3.0,
|
||||||
} else if speed < 0.5 {
|
3.0 + s_a.grip.0 / 1.2 + move1 * 18.0,
|
||||||
next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2);
|
-11.0 + -s_a.grip.0 / 2.0 + move1 * 8.0,
|
||||||
next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2);
|
);
|
||||||
|
|
||||||
next.foot_r.position = Vec3::new(s_a.foot.0, 4.0, s_a.foot.2);
|
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 - move1 * 0.2)
|
||||||
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2)
|
* Quaternion::rotation_y(-0.5 + move1 * 0.3)
|
||||||
* Quaternion::rotation_y(-0.4);
|
* Quaternion::rotation_z(move1 * 0.0);
|
||||||
} else {
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.0)
|
||||||
next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2);
|
* Quaternion::rotation_y(0.5 + move1 * -0.3)
|
||||||
next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2);
|
* Quaternion::rotation_z(move2 * 1.0);
|
||||||
|
|
||||||
next.foot_r.position = Vec3::new(s_a.foot.0, 2.0 + quick * 6.0, s_a.foot.2);
|
next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * 0.8)
|
||||||
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2);
|
* Quaternion::rotation_y(-0.1 + move1 * 0.1 + move2 * 1.0);
|
||||||
};
|
|
||||||
|
next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.5);
|
||||||
|
|
||||||
|
next.lower_torso.orientation = Quaternion::rotation_x(move1 * 0.8);
|
||||||
|
next.torso.position = Vec3::new(0.0, 0.0, move1 * 0.8);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
119
voxygen/anim/src/biped_large/summon.rs
Normal file
119
voxygen/anim/src/biped_large/summon.rs
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
|
use common::{
|
||||||
|
comp::item::{ToolKind, UniqueKind},
|
||||||
|
states::utils::StageSection,
|
||||||
|
};
|
||||||
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
|
pub struct SummonAnimation;
|
||||||
|
|
||||||
|
impl Animation for SummonAnimation {
|
||||||
|
type Dependency = (
|
||||||
|
Option<ToolKind>,
|
||||||
|
Option<ToolKind>,
|
||||||
|
Vec3<f32>,
|
||||||
|
f32,
|
||||||
|
Option<StageSection>,
|
||||||
|
f32,
|
||||||
|
);
|
||||||
|
type Skeleton = BipedLargeSkeleton;
|
||||||
|
|
||||||
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const UPDATE_FN: &'static [u8] = b"biped_large_summon\0";
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_summon")]
|
||||||
|
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||||
|
fn update_skeleton_inner(
|
||||||
|
skeleton: &Self::Skeleton,
|
||||||
|
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency,
|
||||||
|
anim_time: f32,
|
||||||
|
rate: &mut f32,
|
||||||
|
s_a: &SkeletonAttr,
|
||||||
|
) -> Self::Skeleton {
|
||||||
|
*rate = 1.0;
|
||||||
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
|
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||||
|
|
||||||
|
let lab: f32 = 0.65 * s_a.tempo;
|
||||||
|
let speednorm = (speed / 12.0).powf(0.4);
|
||||||
|
let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm;
|
||||||
|
let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm;
|
||||||
|
let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt())
|
||||||
|
* ((acc_vel * lab + PI * 1.4).sin());
|
||||||
|
|
||||||
|
let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt())
|
||||||
|
* ((acc_vel * lab + PI * 0.4).sin());
|
||||||
|
|
||||||
|
let (move1base, move2base, move3) = match stage_section {
|
||||||
|
Some(StageSection::Buildup) => ((anim_time.powf(0.5)), 0.0, 0.0),
|
||||||
|
Some(StageSection::Cast) => (1.0, (anim_time.powi(2)), 0.0),
|
||||||
|
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||||
|
_ => (0.0, 0.0, 0.0),
|
||||||
|
};
|
||||||
|
let pullback = 1.0 - move3;
|
||||||
|
let move1 = move1base * pullback;
|
||||||
|
let move2 = move2base * pullback;
|
||||||
|
|
||||||
|
next.shoulder_l.position = Vec3::new(
|
||||||
|
-s_a.shoulder.0,
|
||||||
|
s_a.shoulder.1,
|
||||||
|
s_a.shoulder.2 - foothorir * 1.0,
|
||||||
|
);
|
||||||
|
next.shoulder_l.orientation =
|
||||||
|
Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotr * -0.2) * speednorm);
|
||||||
|
|
||||||
|
next.shoulder_r.position = Vec3::new(
|
||||||
|
s_a.shoulder.0,
|
||||||
|
s_a.shoulder.1,
|
||||||
|
s_a.shoulder.2 - foothoril * 1.0,
|
||||||
|
);
|
||||||
|
next.shoulder_r.orientation =
|
||||||
|
Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2) * speednorm);
|
||||||
|
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
|
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
|
next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
|
|
||||||
|
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
match active_tool_kind {
|
||||||
|
Some(ToolKind::StaffSimple) | Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => {
|
||||||
|
next.head.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
|
||||||
|
next.control_r.position = Vec3::new(
|
||||||
|
1.0 + move1 * 3.0 + move2 * 20.0,
|
||||||
|
2.0 + move1 * -5.0 + move2 * 5.0,
|
||||||
|
2.0 + move1 * 15.0 + move2 * 0.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
next.control.position = Vec3::new(
|
||||||
|
-3.0 + move2 * 9.0,
|
||||||
|
3.0 + s_a.grip.0 / 1.2 + move1 * 15.0 + move2 * 2.0,
|
||||||
|
-11.0 + -s_a.grip.0 / 2.0 + move1 * 15.0 + move2 * -12.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 - move1 * 0.2)
|
||||||
|
* Quaternion::rotation_y(-0.5 + move2 * -0.4)
|
||||||
|
* Quaternion::rotation_z(move1 * 0.0);
|
||||||
|
next.control_r.orientation = Quaternion::rotation_x(PI / 2.5 + move1 * 0.2)
|
||||||
|
* Quaternion::rotation_y(0.5 + move1 * 0.5 + move2 * 0.0)
|
||||||
|
* Quaternion::rotation_z(move1 * 0.5 + move2 * 0.8);
|
||||||
|
|
||||||
|
next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * 1.0)
|
||||||
|
* Quaternion::rotation_y(-0.1 + move2 * -0.8);
|
||||||
|
},
|
||||||
|
|
||||||
|
_ => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
next
|
||||||
|
}
|
||||||
|
}
|
@ -95,8 +95,8 @@ impl Animation for WieldAnimation {
|
|||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_l.position = Vec3::new(s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip);
|
next.hand_r.position = Vec3::new(-s_a.grip.1, 0.0, s_a.grip.0);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||||
@ -158,8 +158,8 @@ impl Animation for WieldAnimation {
|
|||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
-3.0,
|
-3.0,
|
||||||
5.0 + s_a.grip / 1.2,
|
5.0 + s_a.grip.0 / 1.2,
|
||||||
-4.0 + -s_a.grip / 2.0 + short * -1.5,
|
-4.0 + -s_a.grip.0 / 2.0 + short * -1.5,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
@ -177,8 +177,8 @@ impl Animation for WieldAnimation {
|
|||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
-1.0,
|
-1.0,
|
||||||
6.0 + s_a.grip / 1.2,
|
6.0 + s_a.grip.0 / 1.2,
|
||||||
-5.0 + -s_a.grip / 2.0 + short * -1.5,
|
-5.0 + -s_a.grip.0 / 2.0 + short * -1.5,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
@ -195,8 +195,11 @@ impl Animation for WieldAnimation {
|
|||||||
next.control_l.position = Vec3::new(-1.0, 2.0, 12.0);
|
next.control_l.position = Vec3::new(-1.0, 2.0, 12.0);
|
||||||
next.control_r.position = Vec3::new(1.0, 2.0, -2.0);
|
next.control_r.position = Vec3::new(1.0, 2.0, -2.0);
|
||||||
|
|
||||||
next.control.position =
|
next.control.position = Vec3::new(
|
||||||
Vec3::new(4.0, 0.0 + s_a.grip / 1.0, -s_a.grip / 0.8 + short * -1.5);
|
4.0,
|
||||||
|
0.0 + s_a.grip.0 / 1.0,
|
||||||
|
-s_a.grip.0 / 0.8 + short * -1.5,
|
||||||
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.0);
|
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(-0.0);
|
||||||
@ -207,14 +210,15 @@ impl Animation for WieldAnimation {
|
|||||||
next.control.orientation =
|
next.control.orientation =
|
||||||
Quaternion::rotation_x(-1.0 + short * 0.2) * Quaternion::rotation_y(-1.8);
|
Quaternion::rotation_x(-1.0 + short * 0.2) * Quaternion::rotation_y(-1.8);
|
||||||
},
|
},
|
||||||
Some(ToolKind::StaffSimple) => {
|
Some(ToolKind::StaffSimple)
|
||||||
|
| Some(ToolKind::Unique(UniqueKind::MindflayerStaff)) => {
|
||||||
next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
|
next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
|
||||||
next.control_r.position = Vec3::new(1.0, 2.0, 2.0);
|
next.control_r.position = Vec3::new(1.0, 2.0, 2.0);
|
||||||
|
|
||||||
next.control.position = Vec3::new(
|
next.control.position = Vec3::new(
|
||||||
-3.0,
|
-3.0,
|
||||||
3.0 + s_a.grip / 1.2,
|
3.0 + s_a.grip.0 / 1.2,
|
||||||
-11.0 + -s_a.grip / 2.0 + short * -1.5,
|
-11.0 + -s_a.grip.0 / 2.0 + short * -1.5,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
|
@ -2,12 +2,16 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::states::utils::StageSection;
|
use common::{
|
||||||
|
comp::item::{ToolKind, UniqueKind},
|
||||||
|
states::utils::StageSection,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
pub struct AlphaAnimation;
|
pub struct AlphaAnimation;
|
||||||
|
|
||||||
type AlphaAnimationDependency = (
|
type AlphaAnimationDependency = (
|
||||||
|
Option<ToolKind>,
|
||||||
Vec3<f32>,
|
Vec3<f32>,
|
||||||
Vec3<f32>,
|
Vec3<f32>,
|
||||||
Vec3<f32>,
|
Vec3<f32>,
|
||||||
@ -30,14 +34,15 @@ impl Animation for AlphaAnimation {
|
|||||||
fn update_skeleton_inner(
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(
|
(
|
||||||
|
active_tool_kind,
|
||||||
velocity,
|
velocity,
|
||||||
_orientation,
|
_orientation,
|
||||||
_last_ori,
|
_last_ori,
|
||||||
_global_time,
|
global_time,
|
||||||
_avg_vel,
|
_avg_vel,
|
||||||
_acc_vel,
|
_acc_vel,
|
||||||
stage_section,
|
stage_section,
|
||||||
_timer,
|
timer,
|
||||||
): Self::Dependency,
|
): Self::Dependency,
|
||||||
anim_time: f32,
|
anim_time: f32,
|
||||||
_rate: &mut f32,
|
_rate: &mut f32,
|
||||||
@ -59,9 +64,15 @@ impl Animation for AlphaAnimation {
|
|||||||
_ => (0.0, 0.0, 0.0),
|
_ => (0.0, 0.0, 0.0),
|
||||||
};
|
};
|
||||||
let pullback = 1.0 - move3;
|
let pullback = 1.0 - move3;
|
||||||
|
let subtract = global_time - timer;
|
||||||
|
let check = subtract - subtract.trunc();
|
||||||
|
let mirror = (check - 0.5).signum();
|
||||||
|
let move1 = move1base * pullback * mirror;
|
||||||
|
let move2 = move2base * pullback * mirror;
|
||||||
let move1abs = move1base * pullback;
|
let move1abs = move1base * pullback;
|
||||||
let move2abs = move2base * pullback;
|
let move2abs = move2base * pullback;
|
||||||
|
match active_tool_kind {
|
||||||
|
Some(ToolKind::Spear) => {
|
||||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
next.head.orientation = Quaternion::rotation_x(move1abs * 0.2 + move2abs * 0.3)
|
next.head.orientation = Quaternion::rotation_x(move1abs * 0.2 + move2abs * 0.3)
|
||||||
* Quaternion::rotation_z(move1abs * -0.2 + move2abs * 0.6)
|
* Quaternion::rotation_z(move1abs * -0.2 + move2abs * 0.6)
|
||||||
@ -95,18 +106,40 @@ impl Animation for AlphaAnimation {
|
|||||||
next.control_l.orientation =
|
next.control_l.orientation =
|
||||||
Quaternion::rotation_x(PI / 1.5 + move1abs * -1.5 + move2abs * 2.5)
|
Quaternion::rotation_x(PI / 1.5 + move1abs * -1.5 + move2abs * 2.5)
|
||||||
* Quaternion::rotation_y(-0.3);
|
* Quaternion::rotation_y(-0.3);
|
||||||
next.control_r.orientation =
|
next.control_r.orientation = Quaternion::rotation_x(
|
||||||
Quaternion::rotation_x(PI / 1.5 + s_a.grip.0 * 0.2 + move1abs * -1.5 + move2abs * 2.5)
|
PI / 1.5 + s_a.grip.0 * 0.2 + move1abs * -1.5 + move2abs * 2.5,
|
||||||
* Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2);
|
) * Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2);
|
||||||
|
|
||||||
next.control.orientation = Quaternion::rotation_x(-1.35 + move1abs * -0.3 + move2abs * 0.5)
|
next.control.orientation =
|
||||||
|
Quaternion::rotation_x(-1.35 + move1abs * -0.3 + move2abs * 0.5)
|
||||||
* Quaternion::rotation_z(move1abs * 1.0 + move2abs * -1.0)
|
* Quaternion::rotation_z(move1abs * 1.0 + move2abs * -1.0)
|
||||||
* Quaternion::rotation_y(move2abs * 0.0);
|
* Quaternion::rotation_y(move2abs * 0.0);
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
next.tail.orientation = Quaternion::rotation_x(0.05 * fastalt * speednormcancel)
|
next.tail.orientation = Quaternion::rotation_x(0.05 * fastalt * speednormcancel)
|
||||||
* Quaternion::rotation_z(fast * 0.15 * speednormcancel);
|
* Quaternion::rotation_z(fast * 0.15 * speednormcancel);
|
||||||
|
},
|
||||||
|
Some(ToolKind::Unique(UniqueKind::Husk)) => {
|
||||||
|
next.hand_l.position = Vec3::new(
|
||||||
|
-s_a.hand.0,
|
||||||
|
s_a.hand.1 + move1abs * 3.0 + move2abs * 3.0,
|
||||||
|
s_a.hand.2 + move1abs * 1.5,
|
||||||
|
);
|
||||||
|
next.hand_r.position = Vec3::new(
|
||||||
|
s_a.hand.0,
|
||||||
|
s_a.hand.1 + move1abs * 3.0 + move2abs * 3.0,
|
||||||
|
s_a.hand.2 + move1abs * 1.5,
|
||||||
|
);
|
||||||
|
|
||||||
|
next.hand_l.orientation = Quaternion::rotation_x(1.7 + move1 * 1.3 + move2 * -2.4)
|
||||||
|
* Quaternion::rotation_y(-0.3 + move1abs * -0.35 + move2abs * 0.6);
|
||||||
|
next.hand_r.orientation = Quaternion::rotation_x(1.7 - move1 * 1.3 + move2 * 2.4)
|
||||||
|
* Quaternion::rotation_y(0.3 + move1abs * -0.35 + move2abs * 0.6);
|
||||||
|
next.head.orientation = Quaternion::rotation_x(move1abs * 0.1 + move2abs * -0.2)
|
||||||
|
* Quaternion::rotation_y(move1 * 0.3 + move2 * -0.4);
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
}
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
|||||||
(Gnoll, _) => (0.0, 15.5),
|
(Gnoll, _) => (0.0, 15.5),
|
||||||
(Haniwa, _) => (0.0, 11.0),
|
(Haniwa, _) => (0.0, 11.0),
|
||||||
(Myrmidon, _) => (0.0, 11.0),
|
(Myrmidon, _) => (0.0, 11.0),
|
||||||
(Husk, _) => (0.0, 11.0),
|
(Husk, _) => (0.0, 13.0),
|
||||||
},
|
},
|
||||||
pants: match (body.species, body.body_type) {
|
pants: match (body.species, body.body_type) {
|
||||||
(Gnome, _) => (0.0, -3.0),
|
(Gnome, _) => (0.0, -3.0),
|
||||||
@ -146,7 +146,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
|||||||
(Gnoll, _) => (0.5, -7.5),
|
(Gnoll, _) => (0.5, -7.5),
|
||||||
(Haniwa, _) => (0.0, -3.5),
|
(Haniwa, _) => (0.0, -3.5),
|
||||||
(Myrmidon, _) => (0.0, -3.0),
|
(Myrmidon, _) => (0.0, -3.0),
|
||||||
(Husk, _) => (-1.0, -6.0),
|
(Husk, _) => (-1.0, -3.0),
|
||||||
},
|
},
|
||||||
tail: match (body.species, body.body_type) {
|
tail: match (body.species, body.body_type) {
|
||||||
(Gnome, _) => (0.0, 0.0),
|
(Gnome, _) => (0.0, 0.0),
|
||||||
|
@ -2,7 +2,10 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::{comp::item::ToolKind, states::utils::StageSection};
|
use common::{
|
||||||
|
comp::item::{ToolKind, UniqueKind},
|
||||||
|
states::utils::StageSection,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
pub struct StunnedAnimation;
|
pub struct StunnedAnimation;
|
||||||
@ -150,6 +153,15 @@ impl Animation for StunnedAnimation {
|
|||||||
* Quaternion::rotation_y(-0.2 * speednorm)
|
* Quaternion::rotation_y(-0.2 * speednorm)
|
||||||
* Quaternion::rotation_z(0.5);
|
* Quaternion::rotation_z(0.5);
|
||||||
},
|
},
|
||||||
|
Some(ToolKind::Unique(UniqueKind::Husk)) => {
|
||||||
|
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||||
|
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||||
|
|
||||||
|
next.hand_l.orientation =
|
||||||
|
Quaternion::rotation_x(1.7) * Quaternion::rotation_y(-0.3);
|
||||||
|
next.hand_r.orientation =
|
||||||
|
Quaternion::rotation_x(1.7) * Quaternion::rotation_y(0.3);
|
||||||
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::ToolKind;
|
use common::comp::item::{ToolKind, UniqueKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
pub struct WieldAnimation;
|
pub struct WieldAnimation;
|
||||||
@ -147,6 +147,14 @@ impl Animation for WieldAnimation {
|
|||||||
* Quaternion::rotation_y(-0.2 * speednorm)
|
* Quaternion::rotation_y(-0.2 * speednorm)
|
||||||
* Quaternion::rotation_z(0.5);
|
* Quaternion::rotation_z(0.5);
|
||||||
},
|
},
|
||||||
|
Some(ToolKind::Unique(UniqueKind::Husk)) => {
|
||||||
|
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||||
|
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
||||||
|
|
||||||
|
next.hand_l.orientation =
|
||||||
|
Quaternion::rotation_x(1.7) * Quaternion::rotation_y(-0.3);
|
||||||
|
next.hand_r.orientation = Quaternion::rotation_x(1.7) * Quaternion::rotation_y(0.3);
|
||||||
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2936,6 +2936,7 @@ impl FigureMgr {
|
|||||||
1 => anim::biped_small::AlphaAnimation::update_skeleton(
|
1 => anim::biped_small::AlphaAnimation::update_skeleton(
|
||||||
&target_base,
|
&target_base,
|
||||||
(
|
(
|
||||||
|
active_tool_kind,
|
||||||
rel_vel,
|
rel_vel,
|
||||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||||
@ -2952,6 +2953,7 @@ impl FigureMgr {
|
|||||||
_ => anim::biped_small::AlphaAnimation::update_skeleton(
|
_ => anim::biped_small::AlphaAnimation::update_skeleton(
|
||||||
&target_base,
|
&target_base,
|
||||||
(
|
(
|
||||||
|
active_tool_kind,
|
||||||
rel_vel,
|
rel_vel,
|
||||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||||
@ -3600,6 +3602,36 @@ impl FigureMgr {
|
|||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
CharacterState::Blink(s) => {
|
||||||
|
let stage_time = s.timer.as_secs_f32();
|
||||||
|
|
||||||
|
let stage_progress = match s.stage_section {
|
||||||
|
StageSection::Buildup => {
|
||||||
|
stage_time / s.static_data.buildup_duration.as_secs_f32()
|
||||||
|
},
|
||||||
|
StageSection::Recover => {
|
||||||
|
stage_time / s.static_data.recover_duration.as_secs_f32()
|
||||||
|
},
|
||||||
|
|
||||||
|
_ => 0.0,
|
||||||
|
};
|
||||||
|
|
||||||
|
anim::biped_large::BlinkAnimation::update_skeleton(
|
||||||
|
&target_base,
|
||||||
|
(
|
||||||
|
active_tool_kind,
|
||||||
|
second_tool_kind,
|
||||||
|
rel_vel,
|
||||||
|
time,
|
||||||
|
Some(s.stage_section),
|
||||||
|
state.acc_vel,
|
||||||
|
),
|
||||||
|
stage_progress,
|
||||||
|
&mut state_animation_rate,
|
||||||
|
skeleton_attr,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
CharacterState::ChargedRanged(s) => {
|
CharacterState::ChargedRanged(s) => {
|
||||||
let stage_time = s.timer.as_secs_f32();
|
let stage_time = s.timer.as_secs_f32();
|
||||||
|
|
||||||
@ -3734,25 +3766,19 @@ impl FigureMgr {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
CharacterState::SpinMelee(s) => {
|
CharacterState::SpinMelee(s) => {
|
||||||
let stage_progress = match active_tool_kind {
|
|
||||||
Some(ToolKind::Sword) => {
|
|
||||||
let stage_time = s.timer.as_secs_f32();
|
let stage_time = s.timer.as_secs_f32();
|
||||||
match s.stage_section {
|
let stage_progress = match s.stage_section {
|
||||||
StageSection::Buildup => {
|
StageSection::Buildup => {
|
||||||
stage_time
|
stage_time / s.static_data.buildup_duration.as_secs_f32()
|
||||||
/ s.static_data.buildup_duration.as_secs_f32()
|
|
||||||
},
|
},
|
||||||
|
|
||||||
StageSection::Swing => {
|
StageSection::Swing => {
|
||||||
stage_time / s.static_data.swing_duration.as_secs_f32()
|
stage_time / s.static_data.swing_duration.as_secs_f32()
|
||||||
},
|
},
|
||||||
StageSection::Recover => {
|
StageSection::Recover => {
|
||||||
stage_time
|
stage_time / s.static_data.recover_duration.as_secs_f32()
|
||||||
/ s.static_data.recover_duration.as_secs_f32()
|
|
||||||
},
|
},
|
||||||
_ => 0.0,
|
_ => 0.0,
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => state.state_time,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
anim::biped_large::SpinMeleeAnimation::update_skeleton(
|
anim::biped_large::SpinMeleeAnimation::update_skeleton(
|
||||||
@ -3763,6 +3789,38 @@ impl FigureMgr {
|
|||||||
rel_vel,
|
rel_vel,
|
||||||
time,
|
time,
|
||||||
Some(s.stage_section),
|
Some(s.stage_section),
|
||||||
|
state.acc_vel,
|
||||||
|
),
|
||||||
|
stage_progress,
|
||||||
|
&mut state_animation_rate,
|
||||||
|
skeleton_attr,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
CharacterState::BasicSummon(s) => {
|
||||||
|
let stage_time = s.timer.as_secs_f32();
|
||||||
|
let stage_progress = match s.stage_section {
|
||||||
|
StageSection::Buildup => {
|
||||||
|
stage_time / s.static_data.buildup_duration.as_secs_f32()
|
||||||
|
},
|
||||||
|
|
||||||
|
StageSection::Cast => {
|
||||||
|
stage_time / s.static_data.cast_duration.as_secs_f32()
|
||||||
|
},
|
||||||
|
StageSection::Recover => {
|
||||||
|
stage_time / s.static_data.recover_duration.as_secs_f32()
|
||||||
|
},
|
||||||
|
_ => 0.0,
|
||||||
|
};
|
||||||
|
|
||||||
|
anim::biped_large::SummonAnimation::update_skeleton(
|
||||||
|
&target_base,
|
||||||
|
(
|
||||||
|
active_tool_kind,
|
||||||
|
second_tool_kind,
|
||||||
|
rel_vel,
|
||||||
|
time,
|
||||||
|
Some(s.stage_section),
|
||||||
|
state.acc_vel,
|
||||||
),
|
),
|
||||||
stage_progress,
|
stage_progress,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
|
Loading…
Reference in New Issue
Block a user