theropod retrofit, some more moves

This commit is contained in:
jshipsey 2021-02-14 20:27:28 -05:00
parent 5792faa992
commit ce3b2141e1
27 changed files with 431 additions and 178 deletions

View File

@ -6,13 +6,13 @@ ComboMelee(
damage_increase: 10,
base_poise_damage: 0,
poise_damage_increase: 0,
knockback: 8.0,
knockback: 4.0,
range: 3.5,
angle: 50.0,
base_buildup_duration: 0.6,
base_swing_duration: 0.08,
base_recover_duration: 0.6,
forward_movement: 2.5,
forward_movement: 3.5,
),
(
stage: 2,
@ -20,12 +20,12 @@ ComboMelee(
damage_increase: 15,
base_poise_damage: 0,
poise_damage_increase: 0,
knockback: 12.0,
range: 3.5,
knockback: 16.0,
range: 1.5,
angle: 30.0,
base_buildup_duration: 0.5,
base_swing_duration: 0.1,
base_recover_duration: 0.5,
base_swing_duration: 0.25,
base_recover_duration: 1.2,
forward_movement: 2.0,
),
],

View File

@ -8,9 +8,9 @@ DashMelee(
scaled_knockback: 7.0,
range: 5.0,
angle: 45.0,
energy_drain: 600,
forward_speed: 4.0,
buildup_duration: 0.25,
energy_drain: 0,
forward_speed: 2.0,
buildup_duration: 0.5,
charge_duration: 0.6,
swing_duration: 0.1,
recover_duration: 0.5,

View File

@ -12,7 +12,7 @@ ComboMelee(
base_buildup_duration: 0.35,
base_swing_duration: 0.075,
base_recover_duration: 0.4,
forward_movement: 2.5,
forward_movement: 1.0,
),
(
stage: 2,
@ -26,7 +26,7 @@ ComboMelee(
base_buildup_duration: 0.5,
base_swing_duration: 0.1,
base_recover_duration: 0.5,
forward_movement: 2.0,
forward_movement: 1.0,
),
],
initial_energy_gain: 25,

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1145,7 +1145,7 @@
central: ("npc.horse.male.head"),
),
neck: (
offset: (-3.0, -6.5, -6.5),
offset: (-3.0, -1.5, -5.5),
central: ("npc.horse.male.neck"),
),
jaw: (
@ -1175,7 +1175,7 @@
central: ("npc.horse.male.head"),
),
neck: (
offset: (-3.0, -6.5, -6.5),
offset: (-3.0, -1.5, -5.5),
central: ("npc.horse.male.neck"),
),
jaw: (

View File

@ -217,7 +217,7 @@
lateral: ("npc.raptor_wood.male.hand_r"),
),
leg_l: (
offset: (-2.5, -3.5, -3.5),
offset: (-5.0, -3.5, -3.5),
lateral: ("npc.raptor_wood.male.leg_r"),
),
leg_r: (
@ -243,7 +243,7 @@
lateral: ("npc.raptor_wood.male.hand_r"),
),
leg_l: (
offset: (-2.5, -3.5, -3.5),
offset: (-5.0, -3.5, -3.5),
lateral: ("npc.raptor_wood.male.leg_r"),
),
leg_r: (
@ -269,7 +269,7 @@
lateral: ("npc.sunlizard.male.hand_r"),
),
leg_l: (
offset: (-1.5, -2.5, -3.5),
offset: (-3.0, -2.5, -3.5),
lateral: ("npc.sunlizard.male.leg_r"),
),
leg_r: (
@ -295,7 +295,7 @@
lateral: ("npc.sunlizard.male.hand_r"),
),
leg_l: (
offset: (-1.5, -2.5, -3.5),
offset: (-3.0, -2.5, -3.5),
lateral: ("npc.sunlizard.male.leg_r"),
),
leg_r: (

View File

@ -412,7 +412,7 @@ impl LoadoutBuilder {
"common.items.npc_armor.biped_small.sahagin.pants.sahagin",
)))
.belt(Some(Item::new_from_asset_expect(
"common.items.npc_armor.biped_small.sahagin.belt.sahagin",
"common.items.npc_armor.biped_small.sahagin.tail.sahagin",
)))
.build(),
Haniwa => LoadoutBuilder::new()
@ -451,7 +451,7 @@ impl LoadoutBuilder {
"common.items.npc_armor.biped_small.myrmidon.pants.myrmidon",
)))
.belt(Some(Item::new_from_asset_expect(
"common.items.npc_armor.biped_small.myrmidon.belt.myrmidon",
"common.items.npc_armor.biped_small.myrmidon.tail.myrmidon",
)))
.build(),
Guard => LoadoutBuilder::new()

View File

@ -123,6 +123,8 @@ impl Animation for AlphaAnimation {
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
next.upper_torso.orientation = Quaternion::rotation_z(move1 * 0.2 + move2 * -0.4);
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.2 + move2 * 0.2);
next.control_l.orientation =
Quaternion::rotation_x(PI / 2.0 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2 + move2 * 0.8)

View File

@ -2,7 +2,11 @@ use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use common::{
comp::item::{ToolKind, UniqueKind},
states::utils::StageSection,
};
use std::f32::consts::PI;
pub struct BetaAnimation;
@ -10,9 +14,10 @@ impl Animation for BetaAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f32,
Vec3<f32>,
f64,
Option<StageSection>,
f32,
);
type Skeleton = BipedLargeSkeleton;
@ -22,48 +27,134 @@ impl Animation for BetaAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_beta")]
fn update_skeleton_inner(
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: f64,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let (movement1, movement2, movement3) = match stage_section {
let lab = 0.65 * s_a.tempo;
let speednorm = (speed / 12.0).powf(0.4);
let foothoril = (acc_vel * lab as f32 + PI * 1.45).sin() * speednorm;
let foothorir = (acc_vel * lab as f32 + PI * (0.45)).sin() * speednorm;
let footrotl =
(((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 1.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 1.4).sin());
let footrotr =
(((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 0.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 0.4).sin());
let (move1base, move2base, move3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)),
_ => (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.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
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.hand_l.position = Vec3::new(0.0, 0.0, s_a.grip);
next.hand_r.position = Vec3::new(0.0, 0.0, s_a.grip);
next.control.position = Vec3::new(
s_a.sc.0 + (-1.4 + movement1 * -3.0 + movement2 * -2.0) * (1.0 - movement3),
s_a.sc.1 + (-1.4 + movement1 * 3.0 + movement2 * 3.0) * (1.0 - movement3),
s_a.sc.2 + (10.9 + movement1 * 2.5 * (1.0 - movement3)),
);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - movement3))
* Quaternion::rotation_y(
s_a.sc.4 + (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3),
)
* Quaternion::rotation_z(s_a.sc.5 + (1.67 + movement2 * 1.57) * (1.0 - movement3));
next.upper_torso.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y((-0.1) * (1.0 - movement3))
* Quaternion::rotation_z(
(0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3),
);
next.head.orientation = Quaternion::rotation_z((-0.4) * (1.0 - movement3));
next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
match active_tool_kind {
Some(ToolKind::SwordSimple) => {
next.control_l.position = Vec3::new(-1.0, 1.0, 1.0);
next.control_r.position = Vec3::new(0.0, 2.0, -3.0);
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
next.control.position = Vec3::new(
-3.0 + move1 * -4.0 + move2 * 5.0,
5.0 + s_a.grip / 1.2 + move1 * -4.0 + move2 * 8.0,
-4.0 + -s_a.grip / 2.0 + move2 * -5.0,
);
next.upper_torso.orientation =
Quaternion::rotation_z(move1base * 0.5 + move2 * -0.7);
next.lower_torso.orientation =
Quaternion::rotation_z(move1base * -0.5 + move2 * 0.7);
next.control_l.orientation =
Quaternion::rotation_x(PI / 2.0 + move1 * -0.5 + move2 * 1.5)
* Quaternion::rotation_y(-0.2);
next.control_r.orientation =
Quaternion::rotation_x(PI / 2.2 + move1 * -0.5 + move2 * 1.5)
* Quaternion::rotation_y(0.2)
* Quaternion::rotation_z(0.0);
next.control.orientation =
Quaternion::rotation_x(-0.2 + move1 * 0.5 + move2 * -1.5)
* Quaternion::rotation_y(-0.1 + move1 * -0.5 + move2 * 1.0);
},
Some(ToolKind::HammerSimple) => {
next.control_l.position = Vec3::new(-1.0, 2.0, 12.0 + move2 * -10.0);
next.control_r.position = Vec3::new(1.0, 2.0, -2.0);
next.control.position = Vec3::new(
4.0 + move1 * -12.0 + move2 * 20.0,
(s_a.grip / 1.0) + move1 * -3.0 + move2 * 5.0,
(-s_a.grip / 0.8) + move1 * 6.0 + move2 * 8.0,
);
next.head.orientation = Quaternion::rotation_x(move1 * -0.25)
* Quaternion::rotation_z(move1 * -0.2 + move2 * 0.6);
next.upper_torso.orientation = Quaternion::rotation_z(move1 * 0.6 + move2 * -1.5);
next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.6 + move2 * 1.5);
next.control_l.orientation =
Quaternion::rotation_x(PI / 2.0 + move2 * 0.8) * Quaternion::rotation_y(-0.0);
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + 0.2 + move2 * 0.8)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.orientation =
Quaternion::rotation_x(-1.0 + move1 * -1.5 + move2 * -0.3)
* Quaternion::rotation_y(-1.8 + move1 * -0.8 + move2 * 3.0)
* Quaternion::rotation_z(move1 * -0.8 + move2 * -0.8);
},
Some(ToolKind::Unique(UniqueKind::WendigoMagic)) => {
next.torso.position = Vec3::new(0.0, 0.0, move1 * -0.3);
next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.5 + move2 * -0.4);
next.lower_torso.orientation = Quaternion::rotation_x(move1 * 0.5 + move2 * 0.4);
next.control_l.position =
Vec3::new(-9.0 + move2 * 6.0, 19.0 + move1 * 6.0, -13.0 + move1 * 10.5);
next.control_r.position =
Vec3::new(9.0 + move2 * -6.0, 19.0 + move1 * 6.0, -13.0 + move1 * 14.5);
next.control_l.orientation = Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
* Quaternion::rotation_y(-0.15)
* Quaternion::rotation_z(move1 * 0.5 + move2 * -0.6);
next.control_r.orientation = Quaternion::rotation_x(PI / 3.0 + move1 * 0.5)
* Quaternion::rotation_y(0.15)
* Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6);
next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
},
_ => {},
}
next
}
}

View File

@ -49,6 +49,7 @@ impl Animation for RunAnimation {
let lab = 0.65 * s_a.tempo; //.65
let speednorm = (speed / 12.0).powf(0.6); //.powf(0.4)
let speednormlow = (speed / 12.0).powf(4.0); //.powf(0.4)
let footvertl = (acc_vel * lab as f32 + PI * -0.2).sin() * speednorm;
let footvertr = (acc_vel * lab as f32 + PI * -1.2).sin() * speednorm;
@ -421,9 +422,9 @@ impl Animation for RunAnimation {
next.lower_torso.orientation = Quaternion::rotation_z(short * 0.05 * speednorm)
* Quaternion::rotation_x(0.14 * speednorm);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_x(-0.4 * speednorm + slow * 0.1);
next.shoulder_l.orientation = Quaternion::rotation_x(-0.4 * speednormlow + slow * 0.1);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_x(-0.4 * speednorm + slow * 0.1);
next.shoulder_r.orientation = Quaternion::rotation_x(-0.4 * speednormlow + slow * 0.1);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_x(-0.4 * speednorm + slow * 0.1);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);

View File

@ -0,0 +1,111 @@
use super::{
super::{vek::*, Animation},
BipedSmallSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
use std::f32::consts::PI;
pub struct DashAnimation;
type DashAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
Vec3<f32>,
f32,
Option<StageSection>,
f64,
);
impl Animation for DashAnimation {
type Dependency = DashAnimationDependency;
type Skeleton = BipedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"biped_small_dash\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_small_dash")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(
velocity,
_orientation,
_last_ori,
_global_time,
_avg_vel,
_acc_vel,
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();
//let fastacc = (acc_vel * 2.0).sin();
let fast = (anim_time as f32 * 10.0).sin();
let fastalt = (anim_time as f32 * 10.0 + PI / 2.0).sin();
let speednorm = speed / 9.4;
let speednormcancel = 1.0 - speednorm;
let (move1base, move2base, move3, move4) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, (anim_time as f32).powi(4), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powi(4), 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 - move4;
let move1abs = move1base * pullback;
let move2abs = move2base * pullback;
let move3abs = move2base * pullback;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(move1abs * 0.6)
* Quaternion::rotation_z(move1abs * -0.0)
* Quaternion::rotation_y(move1abs * 0.3);
next.chest.orientation = Quaternion::rotation_x(move1abs * -0.8);
next.pants.orientation = Quaternion::rotation_x(move1abs * -0.2);
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.0 * 4.0, 0.0, s_a.grip.2);
next.hand_r.position = Vec3::new(-s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
next.control_l.position = Vec3::new(1.0 - s_a.grip.0 * 2.0, 2.0, -2.0);
next.control_r.position = Vec3::new(-1.0 + s_a.grip.0 * 2.0, 2.0, 2.0);
next.control.position = Vec3::new(
-3.0,
s_a.grip.2 + move1abs * -5.0,
-s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + move1abs * 4.0,
);
next.control_l.orientation =
Quaternion::rotation_x(PI / 1.5 + move1abs * -0.7 + move3 * 0.7)
* Quaternion::rotation_y(-0.3);
next.control_r.orientation =
Quaternion::rotation_x(PI / 1.5 + s_a.grip.0 * 0.2 + move1abs * -0.7 + move3 * 0.7)
* Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2);
next.control.orientation = Quaternion::rotation_x(-1.35 + move1abs * 0.6)
* Quaternion::rotation_z(move1abs * 0.2)
* Quaternion::rotation_y(move2abs * 0.0);
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)
* Quaternion::rotation_z(fast * 0.15 * speednormcancel);
next
}
}

View File

@ -26,13 +26,13 @@ impl Animation for IdleAnimation {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 4.0).sin();
next.foot_l.scale = Vec3::one() / 13.0;
next.foot_r.scale = Vec3::one() / 13.0;
next.foot_l.scale = Vec3::one() / 11.0;
next.foot_r.scale = Vec3::one() / 11.0;
next.chest.scale = Vec3::one() / 13.0;
next.chest.scale = Vec3::one() / 11.0;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * -0.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.3) / 13.0;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.3) / 11.0;
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
next.main.position = Vec3::new(2.0, -3.0, -3.0);
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
@ -40,8 +40,8 @@ impl Animation for IdleAnimation {
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + slow * -0.1);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + slow * -0.1);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 13.0;
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 13.0;
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next
}

View File

@ -1,4 +1,5 @@
pub mod alpha;
pub mod dash;
pub mod idle;
pub mod run;
pub mod shoot;
@ -6,8 +7,8 @@ pub mod wield;
// Reexports
pub use self::{
alpha::AlphaAnimation, idle::IdleAnimation, run::RunAnimation, shoot::ShootAnimation,
wield::WieldAnimation,
alpha::AlphaAnimation, dash::DashAnimation, idle::IdleAnimation, run::RunAnimation,
shoot::ShootAnimation, wield::WieldAnimation,
};
use super::{make_bone, vek::*, FigureBoneData, Skeleton};

View File

@ -85,13 +85,13 @@ impl Animation for RunAnimation {
* 0.2,
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(1337.0)
.mul(1137.0)
.sin()
* 0.1,
);
next.chest.scale = Vec3::one() / 13.0;
next.foot_l.scale = Vec3::one() / 13.0;
next.foot_r.scale = Vec3::one() / 13.0;
next.chest.scale = Vec3::one() / 11.0;
next.foot_l.scale = Vec3::one() / 11.0;
next.foot_r.scale = Vec3::one() / 11.0;
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0, s_a.head.1 + short * 0.1);
next.head.orientation =
Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.02)
@ -101,7 +101,7 @@ impl Animation for RunAnimation {
0.0,
s_a.chest.0,
s_a.chest.1 + 1.0 * speednorm + shortalt * -0.8,
) / 13.0;
) / 11.0;
next.chest.orientation = Quaternion::rotation_z(short * 0.06 + tilt * -0.6)
* Quaternion::rotation_y(tilt * 1.6)
* Quaternion::rotation_x(shortalter * 0.035 + speednorm * -0.4 + (tilt.abs()));
@ -135,14 +135,14 @@ impl Animation for RunAnimation {
next.foot_l.position = Vec3::new(
-s_a.foot.0 + footstrafel * sideabs * 3.0 + tilt * -2.0,
s_a.foot.1
+ (1.0 - sideabs) * (-1.0 * speednorm + footrotl * -1.5 * speednorm)
+ (1.0 - sideabs) * (-1.0 * speednorm + footrotl * -2.5 * speednorm)
+ (direction * 5.0).max(0.0),
s_a.foot.2
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertl * -1.1 * speednorm).max(-1.0)))
+ side * ((footvertsl * 1.5).max(-1.0)),
) / 13.0;
) / 11.0;
next.foot_l.orientation = Quaternion::rotation_x(
(1.0 - sideabs) * (-0.2 + foothoril * -1.3 * speednorm) + sideabs * -0.5,
(1.0 - sideabs) * (-0.2 * speednorm + foothoril * -0.9 * speednorm) + sideabs * -0.5,
) * Quaternion::rotation_y(
tilt * 2.0 + side * 0.3 + side * (foothoril * 0.3),
) * Quaternion::rotation_z(side * 0.2);
@ -150,14 +150,14 @@ impl Animation for RunAnimation {
next.foot_r.position = Vec3::new(
s_a.foot.0 + footstrafer * sideabs * 3.0 + tilt * -2.0,
s_a.foot.1
+ (1.0 - sideabs) * (-1.0 * speednorm + footrotr * -1.5 * speednorm)
+ (1.0 - sideabs) * (-1.0 * speednorm + footrotr * -2.5 * speednorm)
+ (direction * 5.0).max(0.0),
s_a.foot.2
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertr * -1.1 * speednorm).max(-1.0)))
+ side * ((footvertsr * -1.5).max(-1.0)),
) / 13.0;
) / 11.0;
next.foot_r.orientation = Quaternion::rotation_x(
(1.0 - sideabs) * (-0.2 + foothorir * -1.3 * speednorm) + sideabs * -0.5,
(1.0 - sideabs) * (-0.2 * speednorm + foothorir * -0.9 * speednorm) + sideabs * -0.5,
) * Quaternion::rotation_y(
tilt * 2.0 + side * 0.3 + side * (foothorir * 0.3),
) * Quaternion::rotation_z(side * 0.2);

View File

@ -54,10 +54,10 @@ impl Animation for ShootAnimation {
let speednorm = speed / 9.4;
let speednormcancel = 1.0 - speednorm;
next.foot_l.scale = Vec3::one() / 13.0;
next.foot_r.scale = Vec3::one() / 13.0;
next.foot_l.scale = Vec3::one() / 11.0;
next.foot_r.scale = Vec3::one() / 11.0;
next.chest.scale = Vec3::one() / 13.0;
next.chest.scale = Vec3::one() / 11.0;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + fast * -0.1 * speednormcancel);
next.head.orientation = Quaternion::rotation_x(0.45 * speednorm)
* Quaternion::rotation_y(fast * 0.07 * speednormcancel);
@ -65,7 +65,7 @@ impl Animation for ShootAnimation {
0.0,
s_a.chest.0,
s_a.chest.1 + fastalt * 0.4 * speednormcancel + speednormcancel * -0.5,
) / 13.0;
) / 11.0;
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);

View File

@ -44,10 +44,10 @@ impl Animation for WieldAnimation {
let speednorm = speed / 9.4;
let speednormcancel = 1.0 - speednorm;
next.foot_l.scale = Vec3::one() / 13.0;
next.foot_r.scale = Vec3::one() / 13.0;
next.foot_l.scale = Vec3::one() / 11.0;
next.foot_r.scale = Vec3::one() / 11.0;
next.chest.scale = Vec3::one() / 13.0;
next.chest.scale = Vec3::one() / 11.0;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + fast * -0.1 * speednormcancel);
next.head.orientation = Quaternion::rotation_x(0.45 * speednorm)
* Quaternion::rotation_y(fast * 0.07 * speednormcancel);
@ -55,7 +55,7 @@ impl Animation for WieldAnimation {
0.0,
s_a.chest.0,
s_a.chest.1 + fastalt * 0.4 * speednormcancel + speednormcancel * -0.5,
) / 13.0;
) / 11.0;
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);

View File

@ -145,7 +145,7 @@ impl Animation for RunAnimation {
next.back.orientation =
Quaternion::rotation_x(-0.05 + short * 0.02 + noisea * 0.02 + noiseb * 0.02);
next.shorts.position = Vec3::new(0.0, 0.65 + s_a.shorts.0, 0.65 + s_a.shorts.1);
next.shorts.position = Vec3::new(0.0, 0.65 + s_a.shorts.0, 0.65 * speednorm + s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_x(0.2 * speednorm)
* Quaternion::rotation_z(short * 0.25 + tilt * -1.5)
* Quaternion::rotation_y(tilt * 0.7);

View File

@ -218,7 +218,7 @@ impl Animation for WieldAnimation {
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer) => {
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) => {
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.hhl.0, s_a.hhl.1, s_a.hhl.2);

View File

@ -256,6 +256,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Monitor, _) => (1.1),
(Asp, _) => (1.4),
(Rocksnapper, _) => (1.4),
(Hakulaq, _) => (1.3),
(Pangolin, _) => (1.3),
(Maneater, _) => (1.4),
(Lavadrake, _) => (1.4),
@ -269,6 +270,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Monitor, _) => (1.4),
(Tortoise, _) => (0.7),
(Rocksnapper, _) => (0.7),
(Hakulaq, _) => (1.2),
(Pangolin, _) => (1.15),
(Maneater, _) => (0.9),
(Lavadrake, _) => (1.1),

View File

@ -22,13 +22,12 @@ impl Animation for FeedAnimation {
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slower = (anim_time as f32 * 1.0 + PI).sin();
let slow = (anim_time as f32 * 3.5 + PI).sin();
let fast = (anim_time as f32 * 5.0).sin();
let faster = (anim_time as f32 * 14.0).sin();
let transition = (anim_time as f32).min(0.4) / 0.4;
let transition = (((anim_time as f32).powf(2.0)).min(1.0)) * s_a.feed.1;
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
@ -43,25 +42,21 @@ impl Animation for FeedAnimation {
* 0.25,
);
next.neck.scale = Vec3::one() * 1.02;
next.torso_front.scale = Vec3::one() * s_a.scaler / 11.0;
next.torso_back.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.02;
next.jaw.scale = Vec3::one() * 1.02;
if s_a.feed.0 {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slower * 0.2);
next.head.position = Vec3::new(
0.0,
s_a.head.0,
s_a.head.1 + slower * 0.2 + transition * 1.5,
);
next.head.orientation = Quaternion::rotation_z(0.3 * look.x)
* Quaternion::rotation_x(
fast * 0.05 + faster * 0.08 + 0.8 * s_a.feed.1 * transition,
);
* Quaternion::rotation_x(fast * 0.05 + faster * 0.08 + transition * -0.5);
next.neck.position = Vec3::new(
0.0,
s_a.neck.0,
s_a.neck.1 + slower * 0.1 - 4.0 * transition,
s_a.neck.0 + transition * 1.0,
s_a.neck.1 + slower * 0.1 + transition * 1.5,
);
next.neck.orientation = Quaternion::rotation_x(-2.5 * s_a.feed.1 * transition);
next.neck.orientation = Quaternion::rotation_x(transition * -0.5);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.jaw.orientation = Quaternion::rotation_x((fast * 0.18 + faster * 0.26).min(0.0));
@ -74,48 +69,68 @@ impl Animation for FeedAnimation {
next.jaw.position =
Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2 + 0.5);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05 - 0.08);
next.jaw.orientation =
Quaternion::rotation_x(slow * 0.05 * (anim_time as f32).min(1.0) - 0.08);
}
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(0.0 + slow * 0.2 + look.x);
next.torso_front.position =
Vec3::new(0.0, s_a.torso_front.0, s_a.torso_front.1 + slower * 0.3) * s_a.scaler / 11.0;
next.torso_front.orientation = Quaternion::rotation_y(slow * 0.02);
next.torso_front.position = Vec3::new(
0.0,
s_a.torso_front.0,
s_a.torso_front.1 + slower * 0.3 + transition * -6.0,
) * s_a.scaler
/ 11.0;
next.torso_front.orientation =
Quaternion::rotation_x(transition * -0.7) * Quaternion::rotation_y(slow * 0.02);
next.torso_back.position =
Vec3::new(0.0, s_a.torso_back.0, s_a.torso_back.1 + slower * 0.2);
next.torso_back.orientation = Quaternion::rotation_y(-slow * 0.005);
next.torso_back.orientation =
Quaternion::rotation_x(transition * 0.5) * Quaternion::rotation_y(-slow * 0.005);
next.ears.position = Vec3::new(0.0, s_a.ears.0, s_a.ears.1);
next.ears.orientation = Quaternion::rotation_x(0.0 + slower * 0.03);
next.leg_fl.position = Vec3::new(
-s_a.leg_f.0,
s_a.leg_f.1,
s_a.leg_f.2 + slow * -0.15 + slower * -0.15,
s_a.leg_f.1 + transition * -2.2,
s_a.leg_f.2 + slow * -0.15 + slower * -0.15 + transition * 2.4,
);
next.leg_fl.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_fl.orientation =
Quaternion::rotation_x(transition * 1.0) * Quaternion::rotation_y(slow * -0.02);
next.leg_fr.position = Vec3::new(
s_a.leg_f.0,
s_a.leg_f.1,
s_a.leg_f.2 + slow * 0.15 + slower * -0.15,
s_a.leg_f.1 + transition * -2.2,
s_a.leg_f.2 + slow * 0.15 + slower * -0.15 + transition * 2.4,
);
next.leg_fr.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_fr.orientation =
Quaternion::rotation_x(transition * 1.0) * Quaternion::rotation_y(slow * -0.02);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2 + slower * -0.3);
next.leg_bl.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_bl.position = Vec3::new(
-s_a.leg_b.0,
s_a.leg_b.1,
s_a.leg_b.2 + slower * -0.3 + transition * -1.3,
);
next.leg_bl.orientation =
Quaternion::rotation_x(transition * 0.2) * Quaternion::rotation_y(slow * -0.02);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2 + slower * -0.3);
next.leg_br.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_br.position = Vec3::new(
s_a.leg_b.0,
s_a.leg_b.1,
s_a.leg_b.2 + slower * -0.3 + transition * -1.3,
);
next.leg_br.orientation =
Quaternion::rotation_x(transition * 0.2) * Quaternion::rotation_y(slow * -0.02);
next.foot_fl.position =
Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2 + slower * -0.2);
next.foot_fl.orientation = Quaternion::rotation_x(transition * -0.3);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2 + slower * -0.2);
next.foot_fr.orientation = Quaternion::rotation_x(transition * -0.3);
next.foot_bl.position =
Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2 + slower * -0.2);

View File

@ -162,7 +162,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Zebra, _) => (3.0, -2.0),
(Antelope, _) => (1.5, 2.5),
(Kelpie, _) => (4.0, -1.0),
(Horse, _) => (0.5, 1.5),
(Horse, _) => (4.5, 2.5),
(Barghest, _) => (0.5, -2.5),
(Cattle, Male) => (0.5, 3.5),
(Cattle, Female) => (2.5, 4.0),
@ -192,7 +192,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Zebra, _) => (1.0, 3.5),
(Antelope, _) => (0.5, 2.5),
(Kelpie, _) => (2.0, 1.0),
(Horse, _) => (1.5, 1.5),
(Horse, _) => (-2.5, -1.5),
(Barghest, _) => (0.5, -0.5),
(Cattle, Male) => (0.0, 0.0),
(Cattle, Female) => (0.0, 0.0),
@ -205,7 +205,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
jaw: match (body.species, body.body_type) {
(Grolgar, _) => (7.0, 2.0),
(Saber, _) => (2.5, -2.0),
(Tuskram, _) => (5.5, -3.5),
(Tuskram, _) => (7.5, -3.5),
(Lion, _) => (3.5, -4.0),
(Tarasque, _) => (9.0, -9.5),
(Tiger, _) => (3.0, -3.5),
@ -546,11 +546,11 @@ impl<'a> From<&'a Body> for SkeletonAttr {
},
feed: match (body.species, body.body_type) {
(Tuskram, _) => (true, 0.5),
(Mouflon, _) => (true, 1.0),
(Mouflon, _) => (true, 0.7),
(Deer, _) => (true, 1.0),
(Hirdrasil, _) => (true, 0.9),
(Donkey, _) => (false, 1.0),
(Zebra, _) => (false, 1.0),
(Zebra, _) => (true, 1.0),
(Antelope, _) => (false, 0.9),
(Kelpie, _) => (false, 1.0),
(Horse, _) => (true, 0.85),

View File

@ -26,11 +26,11 @@ impl Animation for RunAnimation {
*rate = 1.0;
//let increasefreqtest = (((1.0/speed)*3.0).round()).min(5.0);
let lab = 0.72; //0.72
let amplitude = (speed / 24.0).powf(0.4);
let amplitude2 = (speed / 24.0).powf(0.4);
let amplitude3 = (speed / 24.0).powf(0.4);
let amplitude = (speed / 24.0).powf(0.6);
let amplitude2 = (speed / 24.0).powf(0.6);
let amplitude3 = (speed / 24.0).powf(0.6);
let speedmult = s_a.tempo;
let canceler = (speed / 24.0).powf(0.4);
let canceler = (speed / 24.0).powf(0.6);
//println!("{} test", canceler);
let short = (((1.0)

View File

@ -186,16 +186,16 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Sunlizard, _) => (2.5, 1.5, -0.5),
},
leg: match (body.species, body.body_type) {
(Archaeos, _) => (4.5, -3.0, -4.0),
(Odonto, _) => (5.5, -2.5, -4.0),
(Archaeos, _) => (2.5, -3.0, -4.0),
(Odonto, _) => (3.5, -2.5, -4.0),
(Sandraptor, _) => (1.5, -2.5, -3.0),
(Snowraptor, _) => (1.5, -2.5, -3.0),
(Woodraptor, _) => (1.5, -2.5, -3.0),
(Sunlizard, _) => (2.5, -2.5, -3.0),
},
foot: match (body.species, body.body_type) {
(Archaeos, _) => (1.0, -0.5, -7.0),
(Odonto, _) => (2.0, -6.5, -3.0),
(Archaeos, _) => (3.0, -0.5, -7.0),
(Odonto, _) => (4.0, -6.5, -3.0),
(Sandraptor, _) => (2.0, 0.0, -3.0),
(Snowraptor, _) => (2.0, 0.0, -3.0),
(Woodraptor, _) => (2.0, 0.0, -3.0),

View File

@ -6,7 +6,7 @@ use std::f32::consts::PI;
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency = (f32, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
type Dependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>, f32);
type Skeleton = TheropodSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -15,7 +15,7 @@ impl Animation for RunAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "theropod_run")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, _global_time, avg_vel): Self::Dependency,
(velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency,
anim_time: f64,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -24,38 +24,31 @@ impl Animation for RunAnimation {
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(22.0);
*rate = 1.0;
let breathe = (anim_time as f32 * 0.8).sin();
let topspeed = 18.0;
//let speednorm = speed / 13.0;
let speednorm = (speed / 13.0).powf(0.25);
let canceler = speed / topspeed;
let lab = 0.5; //6
let amplitude2 = (speed * 1.4 / topspeed).max(0.6);
let amplitude3 = (speed / topspeed).max(0.35);
let speedmult = if speed > 0.0 {
1.2 * (1.0 * 1.0)
} else {
0.9 * (1.0 * 1.0)
};
let speedmult = 1.0;
let lab = 0.6; //6
let short = (((1.0)
/ (0.72
+ 0.28
* ((anim_time as f32 * (16.0) * lab as f32 * speedmult + PI * -0.15 - 0.5)
.sin())
.powi(2)))
* ((acc_vel * 1.0 * lab as f32 * speedmult + PI * -0.15 - 0.5).sin())
.powi(2)))
.sqrt())
* ((anim_time as f32 * (16.0) * lab as f32 * speedmult + PI * -0.15 - 0.5).sin());
* ((acc_vel * 1.0 * lab as f32 * speedmult + PI * -0.15 - 0.5).sin())
* speednorm;
//
let shortalt =
(anim_time as f32 * (16.0) * lab as f32 * speedmult + PI * 3.0 / 8.0 - 0.5).sin();
(acc_vel * 1.0 * lab as f32 * speedmult + PI * 3.0 / 8.0 - 0.5).sin() * speednorm;
//FL
let foot1a = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 0.0 + PI).sin(); //1.5
let foot1b = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + PI).sin(); //1.9
let foot1a = (acc_vel * 1.0 * lab as f32 * speedmult + 0.0 + PI).sin() * speednorm; //1.5
let foot1b = (acc_vel * 1.0 * lab as f32 * speedmult + 1.57 + PI).sin() * speednorm; //1.9
//FR
let foot2a = (anim_time as f32 * (16.0) * lab as f32 * speedmult).sin(); //1.2
let foot2b = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57).sin(); //1.6
let foot2a = (acc_vel * 1.0 * lab as f32 * speedmult).sin() * speednorm; //1.2
let foot2b = (acc_vel * 1.0 * lab as f32 * speedmult + 1.57).sin() * speednorm; //1.6
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
let tilt = if ::vek::Vec2::new(ori, last_ori)
@ -69,7 +62,7 @@ impl Animation for RunAnimation {
} else {
0.0
} * 1.3;
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()) * speednorm;
next.head.scale = Vec3::one() * 1.02;
next.neck.scale = Vec3::one() * 0.98;
@ -78,28 +71,27 @@ impl Animation for RunAnimation {
next.foot_r.scale = Vec3::one() * 0.96;
next.chest_front.scale = Vec3::one() / s_a.scaler;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.3);
next.head.orientation = Quaternion::rotation_x(-0.1 + short * -0.05)
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(-0.1 * speednorm + short * -0.05)
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(shortalt * -0.2 - tilt * 4.5);
* Quaternion::rotation_z(shortalt * -0.2 - tilt * 2.5);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(short * -0.03);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_x(-0.1 + short * -0.04)
next.neck.orientation = Quaternion::rotation_x(-0.1 * speednorm + short * -0.04)
* Quaternion::rotation_y(tilt * 0.3)
* Quaternion::rotation_z(shortalt * -0.1 - tilt * 4.2);
* Quaternion::rotation_z(shortalt * -0.1 - tilt * 3.2);
next.chest_front.position = Vec3::new(
0.0,
s_a.chest_front.0,
s_a.chest_front.1 + short * 0.5 + x_tilt * 10.0 * canceler,
s_a.chest_front.1 + short * 0.5 + x_tilt * 10.0 + 0.5 * speednorm,
) / s_a.scaler;
next.chest_front.orientation =
Quaternion::rotation_x(short * 0.07 + x_tilt * (canceler * 6.0).min(1.0))
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(shortalt * 0.15 + tilt * -1.5);
next.chest_front.orientation = Quaternion::rotation_x(short * 0.07 + x_tilt)
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(shortalt * 0.15 + tilt * -1.5);
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
next.chest_back.orientation = Quaternion::rotation_x(short * -0.04)
@ -115,44 +107,44 @@ impl Animation for RunAnimation {
* Quaternion::rotation_z(shortalt * -0.2 + tilt * 1.4);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.3);
next.hand_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.3);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot1a * 0.3);
next.hand_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.3);
next.leg_l.position = Vec3::new(
-s_a.leg.0,
s_a.leg.1 + amplitude3 * foot1b * -1.3,
s_a.leg.2 + amplitude3 * foot1a * 1.0,
-s_a.leg.0 + speednorm * 1.5,
s_a.leg.1 + foot1b * -1.3,
s_a.leg.2 + foot1a * 1.0,
);
next.leg_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot1a * 0.15)
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
* Quaternion::rotation_y(tilt * 0.5)
* Quaternion::rotation_z(foot1a * -0.3 + tilt * -0.5);
next.leg_r.position = Vec3::new(
s_a.leg.0,
s_a.leg.1 + amplitude3 * foot2b * -1.3,
s_a.leg.2 + amplitude3 * foot2a * 1.0,
s_a.leg.0 + speednorm * -1.5,
s_a.leg.1 + foot2b * -1.3,
s_a.leg.2 + foot2a * 1.0,
);
next.leg_r.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.15)
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
* Quaternion::rotation_y(tilt * 0.5)
* Quaternion::rotation_z(foot2a * 0.3 + tilt * -0.5);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + canceler * -1.0 + amplitude3 * foot1b * -2.0,
s_a.foot.2 + canceler * 2.0 + (foot1a * 1.5).max(0.0) * amplitude2,
s_a.foot.1 + foot1b * -2.0,
s_a.foot.2 + speednorm * 0.5 + (foot1a * 1.5).max(0.0),
);
next.foot_l.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot1b * -0.35)
next.foot_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1b * -0.35)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(tilt * -0.5);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + canceler * -1.0 + amplitude3 * foot2b * -2.0,
s_a.foot.2 + canceler * 2.0 + (foot2a * 1.5).max(0.0) * amplitude2,
s_a.foot.1 + foot2b * -2.0,
s_a.foot.2 + speednorm * 0.5 + (foot2a * 1.5).max(0.0),
);
next.foot_r.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot2b * -0.35)
next.foot_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2b * -0.35)
* Quaternion::rotation_y(tilt * -1.0);
next

View File

@ -53,7 +53,7 @@ use treeculler::{BVol, BoundingSphere};
use vek::*;
const DAMAGE_FADE_COEFFICIENT: f64 = 15.0;
const MOVING_THRESHOLD: f32 = 0.4;
const MOVING_THRESHOLD: f32 = 0.2;
const MOVING_THRESHOLD_SQR: f32 = MOVING_THRESHOLD * MOVING_THRESHOLD;
/// camera data, figure LOD render distance.
@ -2656,6 +2656,40 @@ impl FigureMgr {
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 / 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::biped_small::DashAnimation::update_skeleton(
&target_base,
(
vel.0,
ori,
state.last_ori,
time,
state.avg_vel,
state.acc_vel,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::BasicRanged(s) => {
let stage_time = s.timer.as_secs_f64();
@ -2902,12 +2936,13 @@ impl FigureMgr {
(true, true, false) => anim::theropod::RunAnimation::update_skeleton(
&TheropodSkeleton::default(),
(
vel.0.magnitude(),
vel.0,
// TODO: Update to use the quaternion.
ori * anim::vek::Vec3::<f32>::unit_y(),
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
time,
state.avg_vel,
state.acc_vel,
),
state.state_time,
&mut state_animation_rate,
@ -3426,13 +3461,15 @@ impl FigureMgr {
&mut state_animation_rate,
skeleton_attr,
),
2 => anim::biped_large::SpinAnimation::update_skeleton(
2 => anim::biped_large::BetaAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
vel.0,
time,
Some(s.stage_section),
state.acc_vel,
),
stage_progress,
&mut state_animation_rate,
@ -3443,9 +3480,10 @@ impl FigureMgr {
(
active_tool_kind,
second_tool_kind,
vel.0.magnitude(),
vel.0,
time,
Some(s.stage_section),
state.acc_vel,
),
stage_progress,
&mut state_animation_rate,