assigning weapons, building animations

ability mapping
This commit is contained in:
jshipsey 2020-11-15 14:54:58 -05:00 committed by Sam
parent 793d6095b3
commit c07d8df58b
32 changed files with 1014 additions and 185 deletions

View File

@ -0,0 +1,10 @@
BasicMelee(
energy_cost: 0,
buildup_duration: 250,
swing_duration: 250,
recover_duration: 250,
base_damage: 200,
knockback: 25.0,
range: 2.0,
max_angle: 120.0,
)

View File

@ -0,0 +1,49 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
max_damage: 120,
damage_increase: 10,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 900,
base_swing_duration: 100,
base_recover_duration: 200,
forward_movement: 2.0,
),
(
stage: 2,
base_damage: 80,
max_damage: 110,
damage_increase: 15,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 200,
base_swing_duration: 100,
base_recover_duration: 200,
forward_movement: 1.0,
),
(
stage: 3,
base_damage: 130,
max_damage: 170,
damage_increase: 20,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 200,
base_swing_duration: 100,
base_recover_duration: 200,
forward_movement: 1.0,
),
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
)

View File

@ -0,0 +1,62 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
max_damage: 120,
damage_increase: 10,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 600,
base_swing_duration: 100,
base_recover_duration: 100,
forward_movement: 1.5,
),
(
stage: 2,
base_damage: 80,
max_damage: 110,
damage_increase: 15,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 200,
base_swing_duration: 100,
base_recover_duration: 100,
forward_movement: 0.8,
),
(
stage: 3,
base_damage: 130,
max_damage: 170,
damage_increase: 20,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 200,
base_swing_duration: 100,
base_recover_duration: 100,
forward_movement: 0.8,
),
(
stage: 4,
base_damage: 130,
max_damage: 170,
damage_increase: 20,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 200,
base_swing_duration: 100,
base_recover_duration: 100,
forward_movement: 0.8,
),
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
)

View File

@ -0,0 +1,14 @@
ChargedMelee(
energy_cost: 0,
energy_drain: 0,
initial_damage: 10,
max_damage: 50,
initial_knockback: 10.0,
max_knockback: 30.0,
range: 6.0,
max_angle: 30.0,
speed: 1.0,
charge_duration: 1200,
swing_duration: 700,
recover_duration: 1200,
)

View File

@ -0,0 +1,49 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
max_damage: 120,
damage_increase: 10,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 900,
base_swing_duration: 100,
base_recover_duration: 200,
forward_movement: 2.0,
),
(
stage: 2,
base_damage: 80,
max_damage: 110,
damage_increase: 15,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 200,
base_swing_duration: 100,
base_recover_duration: 200,
forward_movement: 1.0,
),
(
stage: 3,
base_damage: 130,
max_damage: 170,
damage_increase: 20,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 200,
base_swing_duration: 100,
base_recover_duration: 200,
forward_movement: 1.0,
),
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
)

View File

@ -0,0 +1,13 @@
LeapMelee(
energy_cost: 0,
buildup_duration: 500,
movement_duration: 200,
swing_duration: 200,
recover_duration: 200,
base_damage: 240,
knockback: 12.0,
range: 4.5,
max_angle: 30.0,
forward_leap_strength: 28.0,
vertical_leap_strength: 8.0,
)

View File

@ -0,0 +1,17 @@
DashMelee(
energy_cost: 0,
base_damage: 30,
max_damage: 40,
base_knockback: 8.0,
max_knockback: 15.0,
range: 2.0,
angle: 45.0,
energy_drain: 0,
forward_speed: 1.5,
buildup_duration: 1200,
charge_duration: 300,
swing_duration: 100,
recover_duration: 500,
infinite_charge: true,
is_interruptible: true,
)

View File

@ -61,6 +61,36 @@
secondary: "common.abilities.unique.beastclaws.basic",
skills: [],
),
Unique(QuadMedQuick): (
primary: "common.abilities.unique.quadmedquick.dash",
secondary: "common.abilities.unique.quadmedquick.dash",
skills: [],
),
Unique(QuadMedJump): (
primary: "common.abilities.unique.quadmedjump.leap",
secondary: "common.abilities.unique.quadmedjump.leap",
skills: [],
),
Unique(QuadLowRanged): (
primary: "common.abilities.unique.quadlowranged.basic",
secondary: "common.abilities.unique.quadlowranged.firebomb",
skills: [],
),
Unique(QuadLowTail): (
primary: "common.abilities.unique.quadlowtail.charged",
secondary: "common.abilities.unique.quadlowtail.triplestrike",
skills: [],
),
Unique(QuadLowQuick): (
primary: "common.abilities.unique.quadlowquick.dash",
secondary: "common.abilities.unique.quadlowquick.quadstrike",
skills: [],
),
Unique(QuadLowBasic): (
primary: "common.abilities.unique.quadlowbasic.basic",
secondary: "common.abilities.unique.quadlowbasic.triplestrike",
skills: [],
),
Debug: (
primary: "common.abilities.debug.forwardboost",
secondary: "common.abilities.debug.upboost",

View File

@ -0,0 +1,15 @@
ItemDef(
name: "Quad Low Basic",
description: "testing123",
kind: Tool(
(
kind: Unique(QuadLowBasic),
stats: (
equip_time_millis: 10,
power: 1.00,
speed: 1.00,
),
)
),
quality: Low,
)

View File

@ -0,0 +1,15 @@
ItemDef(
name: "Quad Low Quick",
description: "testing123",
kind: Tool(
(
kind: Unique(QuadLowQuick),
stats: (
equip_time_millis: 10,
power: 1.00,
speed: 1.00,
),
)
),
quality: Low,
)

View File

@ -0,0 +1,15 @@
ItemDef(
name: "Quad Low Tail",
description: "testing123",
kind: Tool(
(
kind: Unique(QuadLowTail),
stats: (
equip_time_millis: 10,
power: 1.00,
speed: 1.00,
),
)
),
quality: Low,
)

View File

@ -1,9 +1,9 @@
ItemDef(
name: "Generic Quad Med",
name: "Quad Med Jump",
description: "testing123",
kind: Tool(
(
kind: Unique(GenericQuadMed),
kind: Unique(QuadMedJump),
stats: (
equip_time_millis: 10,
power: 1.00,

View File

@ -0,0 +1,15 @@
ItemDef(
name: "Quad Med Quick",
description: "testing123",
kind: Tool(
(
kind: Unique(QuadMedQuick),
stats: (
equip_time_millis: 10,
power: 1.00,
speed: 1.0,
),
)
),
quality: Low,
)

Binary file not shown.

View File

@ -157,11 +157,11 @@
),
(Monitor, Male): (
upper: (
offset: (-3.0, -5.5, -3.0),
offset: (-3.0, 0.0, -3.0),
central: ("npc.monitor.male.head_upper"),
),
lower: (
offset: (-3.0, -3.5, -3.5),
offset: (-3.0, 0.0, -2.0),
central: ("npc.monitor.male.head_lower"),
),
jaw: (
@ -184,11 +184,11 @@
),
(Monitor, Female): (
upper: (
offset: (-3.0, -5.5, -3.0),
offset: (-3.0, 0.0, -3.0),
central: ("npc.monitor.male.head_upper"),
),
lower: (
offset: (-3.0, -3.5, -3.5),
offset: (-3.0, 0.0, -2.0),
central: ("npc.monitor.male.head_lower"),
),
jaw: (
@ -210,11 +210,11 @@
),
(Asp, Male): (
upper: (
offset: (-5.0, -5.0, -5.0),
offset: (-5.0, 0.0, -5.0),
central: ("npc.asp.male.head_upper"),
),
lower: (
offset: (-6.0, -3.0, -7.5),
offset: (-6.0, -0.0, -2.0),
central: ("npc.asp.male.head_lower"),
),
jaw: (
@ -236,11 +236,11 @@
),
(Asp, Female): (
upper: (
offset: (-5.0, -5.0, -5.0),
offset: (-5.0, 0.0, -5.0),
central: ("npc.asp.male.head_upper"),
),
lower: (
offset: (-6.0, -3.0, -7.5),
offset: (-6.0, -0.0, -2.0),
central: ("npc.asp.male.head_lower"),
),
jaw: (

View File

@ -65,7 +65,7 @@
central: ("npc.saber.male.head"),
),
neck: (
offset: (-4.0, -5.5, -4.0),
offset: (-4.0, -2.0, -4.0),
central: ("npc.saber.male.neck"),
),
jaw: (
@ -95,7 +95,7 @@
central: ("npc.saber.male.head"),
),
neck: (
offset: (-4.0, -5.5, -4.0),
offset: (-4.0, -2.0, -4.0),
central: ("npc.saber.male.neck"),
),
jaw: (
@ -125,7 +125,7 @@
central: ("npc.tuskram.male.head"),
),
neck: (
offset: (-4.0, -5.0, -3.5),
offset: (-4.0, -2.0, -3.5),
central: ("npc.tuskram.male.neck"),
),
jaw: (
@ -155,7 +155,7 @@
central: ("npc.tuskram.male.head"),
),
neck: (
offset: (-4.0, -5.0, -3.5),
offset: (-4.0, -2.0, -3.5),
central: ("npc.tuskram.male.neck"),
),
jaw: (
@ -185,7 +185,7 @@
central: ("npc.lion.male.head"),
),
neck: (
offset: (-7.5, -5.5, -8.5),
offset: (-7.5, -3.0, -8.5),
central: ("npc.lion.male.neck"),
),
jaw: (
@ -215,7 +215,7 @@
central: ("npc.lion.male.head"),
),
neck: (
offset: (-7.5, -5.5, -8.5),
offset: (-7.5, -3.0, -8.5),
central: ("npc.lion.male.neck"),
),
jaw: (
@ -245,7 +245,7 @@
central: ("npc.tarasque.male.head"),
),
neck: (
offset: (-5.0, -3.0, -4.5),
offset: (-5.0, -2.0, -4.5),
central: ("npc.tarasque.male.neck"),
),
jaw: (
@ -275,7 +275,7 @@
central: ("npc.tarasque.male.head"),
),
neck: (
offset: (-5.0, -3.0, -4.5),
offset: (-5.0, -2.0, -4.5),
central: ("npc.tarasque.male.neck"),
),
jaw: (
@ -365,7 +365,7 @@
central: ("npc.wolf.male.head"),
),
neck: (
offset: (-5.0, -4.5, -5.0),
offset: (-5.0, -2.0, -5.0),
central: ("npc.wolf.male.neck"),
),
jaw: (
@ -395,7 +395,7 @@
central: ("npc.wolf.male.head"),
),
neck: (
offset: (-5.0, -4.5, -5.0),
offset: (-5.0, -2.0, -5.0),
central: ("npc.wolf.male.neck"),
),
jaw: (
@ -425,7 +425,7 @@
central: ("npc.frostfang.male.head"),
),
neck: (
offset: (-3.0, -2.0, -4.0),
offset: (-3.0, -1.0, -4.0),
central: ("npc.frostfang.male.neck"),
),
jaw: (
@ -455,7 +455,7 @@
central: ("npc.frostfang.male.head"),
),
neck: (
offset: (-3.0, -2.0, -4.0),
offset: (-3.0, -1.0, -4.0),
central: ("npc.frostfang.male.neck"),
),
jaw: (
@ -485,7 +485,7 @@
central: ("npc.mouflon.male.head"),
),
neck: (
offset: (-4.0, -4.0, -4.5),
offset: (-4.0, -2.0, -4.5),
central: ("npc.mouflon.male.neck"),
),
jaw: (
@ -515,7 +515,7 @@
central: ("npc.mouflon.male.head"),
),
neck: (
offset: (-4.0, -4.0, -4.5),
offset: (-4.0, -2.0, -4.5),
central: ("npc.mouflon.male.neck"),
),
jaw: (
@ -605,7 +605,7 @@
central: ("npc.bonerattler.male.head"),
),
neck: (
offset: (-4.5, -2.0, -5.0),
offset: (-4.5, -1.0, -5.0),
central: ("npc.bonerattler.male.neck"),
),
jaw: (
@ -635,7 +635,7 @@
central: ("npc.bonerattler.male.head"),
),
neck: (
offset: (-4.5, -2.0, -5.0),
offset: (-4.5, -1.0, -5.0),
central: ("npc.bonerattler.male.neck"),
),
jaw: (
@ -665,7 +665,7 @@
central: ("npc.deer.male.head"),
),
neck: (
offset: (-3.0, -3.5, -4.0),
offset: (-3.0, -2.0, -4.0),
central: ("npc.deer.male.neck"),
),
jaw: (
@ -695,7 +695,7 @@
central: ("npc.deer.female.head"),
),
neck: (
offset: (-3.0, -3.5, -4.0),
offset: (-3.0, -2.0, -4.0),
central: ("npc.deer.female.neck"),
),
jaw: (
@ -725,7 +725,7 @@
central: ("npc.hirdrasil.male.head"),
),
neck: (
offset: (-4.0, -4.0, -6.0),
offset: (-4.0, -2.0, -6.0),
central: ("npc.hirdrasil.male.neck"),
),
jaw: (
@ -755,7 +755,7 @@
central: ("npc.hirdrasil.male.head"),
),
neck: (
offset: (-4.0, -4.0, -6.0),
offset: (-4.0, -2.0, -6.0),
central: ("npc.hirdrasil.male.neck"),
),
jaw: (
@ -785,7 +785,7 @@
central: ("npc.roshwalr.male.head"),
),
neck: (
offset: (-7.0, -3.0, -11.5),
offset: (-7.0, -2.0, -11.5),
central: ("npc.roshwalr.male.neck"),
),
jaw: (
@ -815,7 +815,7 @@
central: ("npc.roshwalr.male.head"),
),
neck: (
offset: (-7.0, -3.0, -11.5),
offset: (-7.0, -2.0, -11.5),
central: ("npc.roshwalr.male.neck"),
),
jaw: (

View File

@ -172,6 +172,10 @@ impl Asset for AbilityMap {
pub enum UniqueKind {
StoneGolemFist,
BeastClaws,
GenericQuadMed,
QuadMedQuick,
QuadMedJump,
QuadLowRanged,
QuadLowTail,
QuadLowQuick,
QuadLowBasic,
}

View File

@ -106,10 +106,19 @@ impl LoadoutBuilder {
Body::QuadrupedMedium(quadruped_medium) => match quadruped_medium.species {
quadruped_medium::Species::Wolf => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.genericquadmed",
"common.items.npc_weapons.unique.quadmedquick",
));
},
quadruped_medium::Species::Saber => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadmedjump",
));
},
_ => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadmedquick",
));
},
_ => {},
},
Body::QuadrupedLow(quadruped_low) => match quadruped_low.species {
quadruped_low::Species::Maneater => {
@ -117,7 +126,41 @@ impl LoadoutBuilder {
"common.items.npc_weapons.unique.quadlowranged",
));
},
_ => {},
quadruped_low::Species::Asp => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowranged",
));
},
quadruped_low::Species::Crocodile => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowtail",
));
},
quadruped_low::Species::Alligator => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowtail",
));
},
quadruped_low::Species::Salamander => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowtail",
));
},
quadruped_low::Species::Monitor => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowquick",
));
},
quadruped_low::Species::Pangolin => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowquick",
));
},
_ => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowbasic",
));
},
},
Body::BipedLarge(biped_large) => match (biped_large.species, biped_large.body_type)
{

View File

@ -417,7 +417,7 @@ pub fn handle_ability3_input(data: &JoinData, update: &mut StateUpdate) {
/// Checks that player can perform a dodge, then
/// attempts to go into `loadout.active_item.dodge_ability`
pub fn handle_dodge_input(data: &JoinData, update: &mut StateUpdate) {
if data.inputs.roll.is_pressed() {
if data.inputs.roll.is_pressed() && data.body.is_humanoid() {
if let Some(ability) = data
.loadout
.active_item

View File

@ -352,7 +352,7 @@ impl<'a> System<'a> for Sys {
Some(ToolKind::Unique(UniqueKind::StoneGolemFist)) => {
Tactic::StoneGolemBoss
},
Some(ToolKind::Unique(UniqueKind::GenericQuadMed)) => Tactic::Wolf,
Some(ToolKind::Unique(UniqueKind::QuadMedQuick)) => Tactic::Wolf,
Some(ToolKind::Unique(UniqueKind::QuadLowRanged)) => Tactic::Maneater,
_ => Tactic::Melee,

View File

@ -2,12 +2,13 @@ use super::{
super::{vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
use common::states::utils::StageSection;
//use std::ops::Rem;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (f32, f64);
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,58 +17,44 @@ impl Animation for AlphaAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_alpha")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, _global_time): Self::Dependency,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
s_a: &SkeletonAttr,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let short = (((1.0)
/ (0.1 + 0.9 * ((anim_time as f32 * 8.0 + PI * 2.5).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 8.0 + PI * 2.5).sin());
let quick = (((1.0)
/ (0.001 + 0.9999 * ((anim_time as f32 * 7.0 + PI * 0.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 7.0 + PI * 0.0).sin());
next.head_upper.position = Vec3::new(0.0, s_a.head_upper.0, s_a.head_upper.1);
next.head_upper.orientation = Quaternion::rotation_z(short * 0.3);
next.head_lower.position = Vec3::new(0.0, s_a.head_lower.0, s_a.head_lower.1);
next.head_lower.orientation =
Quaternion::rotation_z(short * 0.2) * Quaternion::rotation_y(short * -0.4);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(-0.2 + quick * 0.3);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
next.chest.orientation = Quaternion::rotation_y(short * -0.07);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y(short * 0.2)
* Quaternion::rotation_z(short * 0.3);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation = Quaternion::rotation_y(short * 0.5)
* Quaternion::rotation_x(-0.12)
* Quaternion::rotation_z(short * 0.3);
if velocity < 1.0 {
next.foot_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fl.orientation = Quaternion::rotation_y(short * 0.12);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fr.orientation = Quaternion::rotation_y(short * 0.12);
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_bl.orientation = Quaternion::rotation_y(short * 0.12);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation = Quaternion::rotation_y(short * 0.12);
} else {
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.5), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(4.0), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let twitch3 = (mirror * movement3 * 9.0).sin();
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
next.head_upper.orientation = Quaternion::rotation_z(twitch3 * -0.7);
next.head_lower.orientation =
Quaternion::rotation_x(movement1abs * 0.35 + movement2abs * -0.9)
* Quaternion::rotation_y(movement1 * 0.7 + movement2 * -1.0);
next.jaw.orientation = Quaternion::rotation_x(movement1abs * -0.6 + movement2abs * 0.6);
next.chest.orientation = Quaternion::rotation_y(movement1 * -0.08 + movement2 * 0.15)
* Quaternion::rotation_z(movement1 * -0.2 + movement2 * 0.6);
next.tail_front.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_z(movement1 * -0.4 + movement2 * -0.2);
next.tail_rear.orientation = Quaternion::rotation_x(-0.12)
* Quaternion::rotation_z(movement1 * -0.4 + movement2 * -0.2);
next
}
}

View File

@ -0,0 +1,60 @@
use super::{
super::{vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
//use std::ops::Rem;
pub struct BetaAnimation;
impl Animation for BetaAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_low_beta\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_beta")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.5), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(4.0), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let twitch3 = (mirror * movement3 * 9.0).sin();
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
next.head_upper.orientation = Quaternion::rotation_z(twitch3 * 0.2);
next.head_lower.orientation =
Quaternion::rotation_x(movement1abs * 0.15 + movement2abs * -0.6)
* Quaternion::rotation_y(movement1 * -0.1 + movement2 * 0.15);
next.jaw.orientation = Quaternion::rotation_x(movement1abs * -1.0 + movement2abs * 1.0);
next.chest.orientation = Quaternion::rotation_y(movement1 * 0.08 + movement2 * -0.15)
* Quaternion::rotation_z(movement1 * 0.2 + movement2 * -0.3);
next.tail_front.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_z(movement1 * 0.4 + movement2 * 0.2);
next.tail_rear.orientation = Quaternion::rotation_x(-0.12)
* Quaternion::rotation_z(movement1 * 0.4 + movement2 * 0.2);
next
}
}

View File

@ -0,0 +1,84 @@
use super::{
super::{vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
//use std::ops::Rem;
use std::f32::consts::PI;
pub struct DashAnimation;
impl Animation for DashAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_low_dash\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_dash")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, chargemovementbase, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.5), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, 1.0, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(4.0), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let twitch1 = (mirror * movement1base * 9.5).sin();
let twitch1fast = (mirror * movement1base * 25.0).sin();
//let twitch3 = (mirror * movement3 * 4.0).sin();
//let movement1 = mirror * movement1base * pullback;
//let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
let short = (((1.0)
/ (0.72
+ 0.28 * ((anim_time as f32 * 16.0 as f32 + PI * 0.25).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 as f32 + PI * 0.25).sin())
* chargemovementbase
* pullback;
let shortalt =
(anim_time as f32 * 16.0 as f32 + PI * 0.25).sin() * chargemovementbase * pullback;
next.head_upper.orientation =
Quaternion::rotation_x(movement1abs * 0.4 + movement2abs * 0.3)
* Quaternion::rotation_z(short * -0.06 + twitch1 * -0.3);
next.head_lower.orientation =
Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * -0.5)
* Quaternion::rotation_z(short * 0.15 + twitch1 * 0.3);
next.jaw.orientation = Quaternion::rotation_x(
twitch1fast * 0.2
+ movement1abs * -0.3
+ movement2abs * 1.2
+ chargemovementbase * -0.5,
);
next.chest.orientation =
Quaternion::rotation_z(twitch1 * 0.06) * Quaternion::rotation_y(short * 0.06);
next.tail_front.orientation = Quaternion::rotation_x(
0.15 + movement1abs * -0.4 + movement2abs * 0.2 + chargemovementbase * 0.2,
) * Quaternion::rotation_z(shortalt * 0.15);
next.tail_rear.orientation =
Quaternion::rotation_x(
-0.12 + movement1abs * -0.4 + movement2abs * 0.2 + chargemovementbase * 0.2,
) * Quaternion::rotation_z(shortalt * 0.15 + twitch1fast * 0.3);
next
}
}

View File

@ -1,13 +1,16 @@
pub mod alpha;
pub mod beta;
pub mod dash;
pub mod idle;
pub mod jump;
pub mod run;
pub mod shoot;
pub mod tailwhip;
// Reexports
pub use self::{
alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation,
shoot::ShootAnimation,
alpha::AlphaAnimation, beta::BetaAnimation, dash::DashAnimation, idle::IdleAnimation,
jump::JumpAnimation, run::RunAnimation, shoot::ShootAnimation, tailwhip::TailwhipAnimation,
};
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
@ -116,8 +119,8 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Alligator, _) => (0.5, 2.0),
(Salamander, Male) => (0.5, 2.5),
(Salamander, Female) => (0.5, 1.0),
(Monitor, _) => (4.5, 1.0),
(Asp, _) => (6.0, 5.5),
(Monitor, _) => (5.5, 3.0),
(Asp, _) => (4.5, 10.5),
(Tortoise, _) => (5.0, 1.0),
(Rocksnapper, _) => (6.0, 0.5),
(Pangolin, _) => (-0.5, 8.0),
@ -130,8 +133,8 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Alligator, _) => (9.0, 0.25),
(Salamander, Male) => (9.0, 0.0),
(Salamander, Female) => (9.0, 0.0),
(Monitor, _) => (10.0, 2.0),
(Asp, _) => (9.0, 2.5),
(Monitor, _) => (7.0, 0.0),
(Asp, _) => (6.0, -2.5),
(Tortoise, _) => (12.0, -3.5),
(Rocksnapper, _) => (12.0, -9.0),
(Pangolin, _) => (8.0, -9.0),
@ -144,8 +147,8 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Alligator, _) => (2.5, -2.0),
(Salamander, Male) => (0.0, -2.0),
(Salamander, Female) => (0.5, -1.0),
(Monitor, _) => (-2.0, -1.0),
(Asp, _) => (-3.0, -2.0),
(Monitor, _) => (3.0, -1.0),
(Asp, _) => (2.0, -2.0),
(Tortoise, _) => (-3.5, -2.0),
(Rocksnapper, _) => (-5.0, -1.5),
(Pangolin, _) => (0.0, 0.0),

View File

@ -113,7 +113,7 @@ impl Animation for RunAnimation {
* Quaternion::rotation_y(shortalt * 0.1)
* Quaternion::rotation_x(0.06 - s_a.lean.0 * 1.2 + x_tilt * 0.2);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1 + shortalt * 0.6);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation =
Quaternion::rotation_z(shortalt * 0.25 * s_a.lean.1 + tilt * 1.6)
* Quaternion::rotation_y(shortalt * 0.1)

View File

@ -37,7 +37,9 @@ impl Animation for ShootAnimation {
* Quaternion::rotation_z((twitch1 * 0.1) * (1.0 - movement3));
next.head_lower.position = Vec3::new(0.0, s_a.head_lower.0, s_a.head_lower.1);
next.head_lower.orientation = Quaternion::rotation_x(movement2 * 0.3 * (1.0 - movement3));
next.head_lower.orientation = Quaternion::rotation_x(
(twitch1 * 0.05 + movement1 * 0.3 + movement2 * 0.6) * (1.0 - movement3),
);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(movement1 * -0.5);

View File

@ -0,0 +1,72 @@
use super::{
super::{vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
pub struct TailwhipAnimation;
impl Animation for TailwhipAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_low_tailwhip\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_tailwhip")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2base, movement3, twitch) = match stage_section {
Some(StageSection::Charge) => (
(anim_time as f32).min(1.2),
0.0,
0.0,
(anim_time as f32 * 15.0).sin(),
),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(4.0), 0.0, 1.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(6.0), 1.0),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let twitchfinal = mirror * (anim_time as f32 * 10.0).sin();
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement1nopull = mirror * movement1base;
let movement2nopull = mirror * movement2base;
next.head_upper.orientation = Quaternion::rotation_z(movement1 * 0.6 + movement2 * -1.2);
next.head_lower.orientation = Quaternion::rotation_z(movement1 * 0.7 + movement2 * -1.6);
next.chest.orientation = Quaternion::rotation_z(
(mirror * twitch * 0.02 + movement1nopull * -0.4 + movement2nopull * 3.0)
+ (movement3 * 4.0 * mirror),
);
next.jaw.orientation = Quaternion::rotation_x(movement1 * -0.1 + movement2 * 0.1);
next.tail_front.orientation = Quaternion::rotation_x(0.15 + (movement1abs * -0.4))
* Quaternion::rotation_z(
(twitch * 0.15 + movement1 * -0.6 + movement2 * 0.9)
* (1.0 - movement3 + twitchfinal * 0.2),
);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation = Quaternion::rotation_x(-0.12 + (movement1abs * -0.45))
* Quaternion::rotation_z(
(mirror * twitch * 0.2 + movement1 * -0.6 + movement2 * 0.7)
* (1.0 - movement3 + twitchfinal * 0.2),
);
next
}
}

View File

@ -7,7 +7,7 @@ use common::states::utils::StageSection;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (f32, f64, Option<StageSection>);
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,103 +16,72 @@ impl Animation for AlphaAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_alpha")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, _global_time, stage_section): Self::Dependency,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
//let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(1.0), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (0.0, 1.0, (anim_time as f32).powf(4.0)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let movement1 = movement1base * mirror * pullback;
let movement1abs = movement1base * pullback;
//let movement2 = movement2base*mirror*pullback;
let movement2abs = movement2base * pullback;
let twitch1 = (movement1 * 10.0).sin() * pullback;
let twitch2 = (movement3 * 5.0).sin() * pullback;
let twitchmovement = twitch1 + twitch2;
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup | StageSection::Recover | StageSection::Swing => {
let twitch1 = (movement1 * 20.0).sin();
let twitch2 = (movement3 * 5.0).sin();
let twitchmovement = twitch1 + twitch2;
next.head.orientation = Quaternion::rotation_x(movement1abs * 0.2 + movement2abs * 0.2)
* Quaternion::rotation_y(twitchmovement * 0.3 * mirror);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation =
Quaternion::rotation_x(
(movement1 * 0.4 + movement2 * 0.4) * (1.0 - movement3),
) * Quaternion::rotation_y(twitchmovement * 0.2 * (1.0 - movement3));
next.neck.orientation = Quaternion::rotation_x(movement1abs * -0.2)
* Quaternion::rotation_y(twitchmovement * 0.1 * mirror);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation =
Quaternion::rotation_x(movement1 * -0.7 * (1.0 - movement3))
* Quaternion::rotation_y(twitchmovement * 0.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(twitchmovement * 0.1);
next.jaw.scale = Vec3::one() * 1.02;
next.jaw.orientation = Quaternion::rotation_x(twitchmovement * 0.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(twitchmovement * 1.0);
next.tail.orientation = Quaternion::rotation_z(twitchmovement * 1.0 * mirror);
next.torso_front.position = Vec3::new(
0.0,
s_a.torso_front.0 + movement1abs * -4.0,
s_a.torso_front.1,
) * s_a.scaler
/ 11.0;
next.torso_front.orientation = Quaternion::rotation_x(movement1abs * 0.3)
* Quaternion::rotation_y(twitchmovement * -0.1 * mirror);
next.torso_front.position =
Vec3::new(0.0, s_a.torso_front.0, s_a.torso_front.1) * s_a.scaler / 11.0;
next.torso_front.orientation =
Quaternion::rotation_x(movement1 * 0.2 * (1.0 - movement3))
* Quaternion::rotation_y(twitchmovement * -0.1);
next.torso_back.orientation = Quaternion::rotation_x(movement1abs * -0.45)
* Quaternion::rotation_y(twitchmovement * 0.1 * mirror);
next.torso_back.position = Vec3::new(0.0, s_a.torso_back.0, s_a.torso_back.1);
next.torso_back.orientation =
Quaternion::rotation_x(movement1 * -0.3 * (1.0 - movement3))
* Quaternion::rotation_y(twitchmovement * 0.1);
next.ears.orientation = Quaternion::rotation_x(twitchmovement * 0.1);
next.leg_fl.orientation = Quaternion::rotation_x(movement1abs * 0.8)
* Quaternion::rotation_y(twitchmovement * 0.1 * mirror);
next.ears.position = Vec3::new(0.0, s_a.ears.0, s_a.ears.1);
next.ears.orientation =
Quaternion::rotation_x(twitchmovement * 0.1 * (1.0 - movement3));
if speed < 0.5 {
next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fl.orientation =
Quaternion::rotation_x(movement1 * 0.6 * (1.0 - movement3))
* Quaternion::rotation_y(twitchmovement * 0.1);
next.leg_fr.orientation = Quaternion::rotation_x(movement1abs * 0.8)
* Quaternion::rotation_y(twitchmovement * 0.1 * mirror);
next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fr.orientation =
Quaternion::rotation_x(movement1 * 0.6 * (1.0 - movement3))
* Quaternion::rotation_y(twitchmovement * 0.1);
next.leg_bl.orientation = Quaternion::rotation_x(movement1abs * 0.4);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_bl.orientation =
Quaternion::rotation_x(movement1 * 0.5 * (1.0 - movement3));
next.leg_br.orientation = Quaternion::rotation_x(movement1abs * 0.4);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_br.orientation =
Quaternion::rotation_x(movement1 * 0.5 * (1.0 - movement3));
next.foot_fl.orientation = Quaternion::rotation_x(movement1abs * -0.9);
next.foot_fl.position =
Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fl.orientation =
Quaternion::rotation_x(movement1 * -0.5 * (1.0 - movement3));
next.foot_fr.orientation = Quaternion::rotation_x(movement1abs * -0.9);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fr.orientation =
Quaternion::rotation_x(movement1 * -0.5 * (1.0 - movement3));
next.foot_bl.orientation = Quaternion::rotation_x(movement1abs * -1.1);
next.foot_bl.position =
Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_bl.orientation =
Quaternion::rotation_x(movement1 * -1.0 * (1.0 - movement3));
next.foot_br.orientation = Quaternion::rotation_x(movement1abs * -1.1);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation =
Quaternion::rotation_x(movement1 * -1.0 * (1.0 - movement3));
};
},
StageSection::Charge => {
next.jaw.orientation = Quaternion::rotation_x(-1.0);
},
_ => {},
}
}
next
}
}

View File

@ -0,0 +1,87 @@
use super::{
super::{vek::*, Animation},
QuadrupedMediumSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
pub struct LeapMeleeAnimation;
impl Animation for LeapMeleeAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_medium_leapmelee\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_leapmelee")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
//let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(1.0), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (0.0, 1.0, (anim_time as f32).powf(4.0)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let movement1 = movement1base * mirror * pullback;
let movement1abs = movement1base * pullback;
//let movement2 = movement2base*mirror*pullback;
let movement2abs = movement2base * pullback;
let twitch1 = (movement1 * 10.0).sin() * pullback;
let twitch2 = (movement3 * 5.0).sin() * pullback;
let twitchmovement = twitch1 + twitch2;
next.head.orientation = Quaternion::rotation_x(movement1abs * 0.2 + movement2abs * 0.2)
* Quaternion::rotation_y(twitchmovement * 0.3 * mirror);
next.neck.orientation = Quaternion::rotation_x(movement1abs * -0.2)
* Quaternion::rotation_y(twitchmovement * 0.1 * mirror);
next.jaw.orientation = Quaternion::rotation_x(twitchmovement * 0.1);
next.tail.orientation = Quaternion::rotation_z(twitchmovement * 1.0 * mirror);
next.torso_front.position = Vec3::new(
0.0,
s_a.torso_front.0 + movement1abs * -4.0,
s_a.torso_front.1,
) * s_a.scaler
/ 11.0;
next.torso_front.orientation = Quaternion::rotation_x(movement1abs * 0.3)
* Quaternion::rotation_y(twitchmovement * -0.1 * mirror);
next.torso_back.orientation = Quaternion::rotation_x(movement1abs * -0.45)
* Quaternion::rotation_y(twitchmovement * 0.1 * mirror);
next.ears.orientation = Quaternion::rotation_x(twitchmovement * 0.1);
next.leg_fl.orientation = Quaternion::rotation_x(movement1abs * 0.8)
* Quaternion::rotation_y(twitchmovement * 0.1 * mirror);
next.leg_fr.orientation = Quaternion::rotation_x(movement1abs * 0.8)
* Quaternion::rotation_y(twitchmovement * 0.1 * mirror);
next.leg_bl.orientation = Quaternion::rotation_x(movement1abs * 0.4);
next.leg_br.orientation = Quaternion::rotation_x(movement1abs * 0.4);
next.foot_fl.orientation = Quaternion::rotation_x(movement1abs * -0.9);
next.foot_fr.orientation = Quaternion::rotation_x(movement1abs * -0.9);
next.foot_bl.orientation = Quaternion::rotation_x(movement1abs * -1.1);
next.foot_br.orientation = Quaternion::rotation_x(movement1abs * -1.1);
next
}
}

View File

@ -2,12 +2,13 @@ pub mod alpha;
pub mod feed;
pub mod idle;
pub mod jump;
pub mod leapmelee;
pub mod run;
// Reexports
pub use self::{
alpha::AlphaAnimation, feed::FeedAnimation, idle::IdleAnimation, jump::JumpAnimation,
run::RunAnimation,
leapmelee::LeapMeleeAnimation, run::RunAnimation,
};
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
@ -137,18 +138,18 @@ impl<'a> From<&'a Body> for SkeletonAttr {
Self {
head: match (body.species, body.body_type) {
(Grolgar, _) => (0.0, -1.0),
(Saber, _) => (0.0, -3.0),
(Tuskram, _) => (0.0, 1.0),
(Lion, _) => (2.5, 2.0),
(Saber, _) => (5.0, -3.0),
(Tuskram, _) => (2.0, 1.0),
(Lion, _) => (4.5, 2.0),
(Tarasque, _) => (-4.0, 3.5),
(Tiger, _) => (2.0, 1.0),
(Wolf, _) => (-0.5, 3.0),
(Frostfang, _) => (1.0, -2.0),
(Mouflon, _) => (0.5, 1.5),
(Catoblepas, _) => (-1.0, -6.5),
(Bonerattler, _) => (-1.0, 2.5),
(Deer, Male) => (0.5, 3.5),
(Deer, Female) => (0.5, 3.5),
(Bonerattler, _) => (1.0, 2.5),
(Deer, Male) => (1.5, 3.5),
(Deer, Female) => (1.5, 3.5),
(Hirdrasil, _) => (0.0, 5.0),
(Roshwalr, _) => (1.0, 0.5),
(Donkey, _) => (4.5, -3.0),
@ -160,17 +161,17 @@ impl<'a> From<&'a Body> for SkeletonAttr {
},
neck: match (body.species, body.body_type) {
(Grolgar, _) => (1.0, -1.0),
(Saber, _) => (1.0, 0.0),
(Tuskram, _) => (1.0, 1.0),
(Lion, _) => (0.5, 1.0),
(Tarasque, _) => (0.5, -4.0),
(Saber, _) => (-3.5, -2.0),
(Tuskram, _) => (-1.0, 1.0),
(Lion, _) => (-1.5, 1.0),
(Tarasque, _) => (-1.5, -4.0),
(Tiger, _) => (0.0, 0.0),
(Wolf, _) => (-4.5, 2.0),
(Frostfang, _) => (2.0, 1.5),
(Mouflon, _) => (-1.0, 1.0),
(Catoblepas, _) => (19.5, -2.0),
(Bonerattler, _) => (7.0, -1.5),
(Deer, _) => (-0.5, 1.0),
(Bonerattler, _) => (9.0, -0.5),
(Deer, _) => (-2.5, 1.0),
(Hirdrasil, _) => (-1.0, 0.5),
(Roshwalr, _) => (0.0, 1.0),
(Donkey, _) => (1.0, 3.5),

View File

@ -1528,6 +1528,35 @@ impl FigureMgr {
),
};
let target_bones = match &character {
CharacterState::BasicMelee(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f64()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::quadruped_medium::AlphaAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::DashMelee(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
@ -1545,7 +1574,42 @@ impl FigureMgr {
};
anim::quadruped_medium::AlphaAnimation::update_skeleton(
&target_base,
(vel.0.magnitude(), time, Some(s.stage_section)),
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::LeapMelee(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Movement => {
stage_time / s.static_data.movement_duration.as_secs_f64()
},
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f64()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::quadruped_medium::LeapMeleeAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
@ -1681,6 +1745,155 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::BasicMelee(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f64()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::quadruped_low::BetaAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::ChargedMelee(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Charge => {
stage_time / s.static_data.charge_duration.as_secs_f64()
},
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f64()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::quadruped_low::TailwhipAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::ComboMelee(s) => {
let stage_index = (s.stage - 1) as usize;
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_buildup_duration
.as_secs_f64()
},
StageSection::Swing => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_swing_duration
.as_secs_f64()
},
StageSection::Recover => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_recover_duration
.as_secs_f64()
},
_ => 0.0,
};
match s.stage {
1 => anim::quadruped_low::AlphaAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
),
2 => anim::quadruped_low::BetaAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
),
_ => anim::quadruped_low::AlphaAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
),
}
},
CharacterState::DashMelee(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Charge => stage_time,
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f64()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::quadruped_low::DashAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
// TODO!
_ => target_base,
};