Reduces the instances of f64 in anims

This commit is contained in:
Snowram 2021-02-27 23:21:03 +01:00
parent 04c698be5e
commit 7f2276324e
107 changed files with 1079 additions and 1391 deletions

View File

@ -15,7 +15,7 @@ impl Animation for AlphaAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
f32,
);
@ -29,7 +29,7 @@ impl Animation for AlphaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -37,21 +37,19 @@ impl Animation for AlphaAnimation {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab = 0.65 * s_a.tempo;
let lab: f32 = 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 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 as f32 + PI * 0.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 0.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 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)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;

View File

@ -11,7 +11,7 @@ impl Animation for BeamAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f64,
f32,
Vec3<f32>,
Option<StageSection>,
f32,
@ -26,7 +26,7 @@ impl Animation for BeamAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _global_time, velocity, stage_section, acc_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -35,18 +35,16 @@ impl Animation for BeamAnimation {
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab = 0.65 * s_a.tempo;
let lab: f32 = 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 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())
* speednorm;
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 footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab + PI * 0.4).sin())
* speednorm;
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
@ -64,18 +62,18 @@ impl Animation for BeamAnimation {
Some(ToolKind::StaffSimple) | Some(ToolKind::Sceptre) => {
let (move1base, move2shake, _move2base, move3) = match stage_section {
Some(StageSection::Buildup) => (
((anim_time as f32).powf(0.25)).min(1.0),
(anim_time as f32 * 10.0 + PI).sin(),
(anim_time as f32 * 10.0 + PI).sin(),
(anim_time.powf(0.25)).min(1.0),
(anim_time * 10.0 + PI).sin(),
(anim_time * 10.0 + PI).sin(),
0.0,
),
Some(StageSection::Cast) => (
1.0,
(anim_time as f32 * 10.0 + PI).sin(),
(anim_time as f32).powf(0.25),
(anim_time * 10.0 + PI).sin(),
anim_time.powf(0.25),
0.0,
),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;

View File

@ -15,7 +15,7 @@ impl Animation for BetaAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
f32,
);
@ -28,7 +28,7 @@ impl Animation for BetaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -36,21 +36,19 @@ impl Animation for BetaAnimation {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab = 0.65 * s_a.tempo;
let lab: f32 = 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 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 as f32 + PI * 0.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 0.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 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(6)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(6)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;

View File

@ -13,7 +13,7 @@ impl Animation for ChargeAnimation {
f32,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
);
type Skeleton = BipedLargeSkeleton;
@ -24,29 +24,24 @@ impl Animation for ChargeAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, velocity, orientation, last_ori, _global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 1.0;
let lab: f32 = 1.0;
let foot = (((5.0) / (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 8.0).sin());
let foote = (((5.0)
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 8.0 + 1.57).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 8.0).sin());
let stress =
(((5.0) / (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 20.0).cos()).powi(2))).sqrt())
* ((anim_time as f32 * lab as f32 * 20.0).cos());
let quick = (((5.0) / (3.5 + 1.5 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 8.0).sin());
let stop = ((anim_time as f32).powf(0.3)).min(1.2);
let stopa = ((anim_time as f32).powf(0.9)).min(5.0);
let foot = ((5.0 / (0.2 + 4.8 * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt())
* ((anim_time * lab * 8.0).sin());
let foote = ((5.0 / (0.5 + 4.5 * ((anim_time * lab * 8.0 + 1.57).sin()).powi(2))).sqrt())
* ((anim_time * lab * 8.0).sin());
let stress = ((5.0 / (0.5 + 4.5 * ((anim_time * lab * 20.0).cos()).powi(2))).sqrt())
* ((anim_time * lab * 20.0).cos());
let quick = ((5.0 / (3.5 + 1.5 * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt())
* ((anim_time * lab * 8.0).sin());
let stop = (anim_time.powf(0.3)).min(1.2);
let stopa = (anim_time.powf(0.9)).min(5.0);
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);

View File

@ -12,7 +12,7 @@ impl Animation for DashAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
f32,
);
@ -26,25 +26,23 @@ impl Animation for DashAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let lab = 0.65 * s_a.tempo;
let lab: f32 = 0.65 * s_a.tempo;
let speed = Vec2::<f32>::from(velocity).magnitude();
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 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 as f32 + PI * 0.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 0.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());
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
@ -55,10 +53,10 @@ impl Animation for DashAnimation {
next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
let (move1base, move2base, move3base, move4) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, ((anim_time as f32).powf(4.0)).min(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.1, 1.0, 1.0, (anim_time as f32).powf(4.0)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, (anim_time.powf(4.0)).min(1.0), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(4.0), 0.0),
Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time.powf(4.0)),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - move4;

View File

@ -8,7 +8,7 @@ use std::f32::consts::PI;
pub struct EquipAnimation;
impl Animation for EquipAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f32);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -19,15 +19,15 @@ impl Animation for EquipAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let equip_slow = 1.0 + (anim_time as f32 * 12.0 + PI).cos();
let equip_slowa = 1.0 + (anim_time as f32 * 12.0 + PI / 4.0).cos();
let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos();
let equip_slowa = 1.0 + (anim_time * 12.0 + PI / 4.0).cos();
next.hand_l.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(-1.57);
next.hand_r.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57);
next.control.position = Vec3::new(equip_slowa * -1.5, 0.0, equip_slow * 1.5);

View File

@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,29 +18,21 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 1.0;
let torso = (anim_time as f32 * lab as f32 + 1.5 * PI).sin() * 1.5;
let lab: f32 = 1.0;
let torso = (anim_time * lab + 1.5 * PI).sin() * 1.5;
let slower = (anim_time as f32 * 2.0 + PI).sin() * 1.5;
let slow = (anim_time as f32 * 7.0 + PI).sin() * 1.5;
let slower = (anim_time * 2.0 + PI).sin() * 1.5;
let slow = (anim_time * 7.0 + PI).sin() * 1.5;
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25,
);
let breathe = if s_a.beast {
@ -49,11 +41,8 @@ impl Animation for IdleAnimation {
let lenght = 1.5;
let chop = 0.2;
let chop_freq = 60.0;
intensity * (lenght * anim_time as f32).sin()
+ 0.05
* chop
* (anim_time as f32 * chop_freq).sin()
* (anim_time as f32 * lenght).cos()
intensity * (lenght * anim_time).sin()
+ 0.05 * chop * (anim_time * chop_freq).sin() * (anim_time * lenght).cos()
} else {
0.0
};

View File

@ -8,7 +8,7 @@ use std::f32::consts::PI;
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,16 +18,16 @@ impl Animation for JumpAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 1.0;
let torso = (anim_time as f32 * lab as f32 + 1.5 * PI).sin();
let lab: f32 = 1.0;
let torso = (anim_time * lab + 1.5 * PI).sin();
let wave_slow = (anim_time as f32 * 0.8).sin();
let wave_slow = (anim_time * 0.8).sin();
next.head.scale = Vec3::one() * 1.02;

View File

@ -10,7 +10,7 @@ impl Animation for LeapAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = BipedLargeSkeleton;
@ -23,7 +23,7 @@ impl Animation for LeapAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -31,10 +31,10 @@ impl Animation for LeapAnimation {
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3, movement4) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, (anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0, 0.0),
};

View File

@ -13,7 +13,7 @@ type RunAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
Vec3<f32>,
f32,
);
@ -37,7 +37,7 @@ impl Animation for RunAnimation {
avg_vel,
acc_vel,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -47,20 +47,18 @@ impl Animation for RunAnimation {
*rate = 1.0;
let lab = 0.65 * s_a.tempo;
let lab: f32 = 0.65 * s_a.tempo;
let speednorm = (speed / 12.0).powf(0.6);
let speednormlow = (speed / 12.0).powf(4.0);
let footvertl = (acc_vel * lab as f32 + PI * -0.2).sin() * speednorm;
let footvertr = (acc_vel * lab as f32 + PI * -1.2).sin() * speednorm;
let footvertl = (acc_vel * lab + PI * -0.2).sin() * speednorm;
let footvertr = (acc_vel * lab + PI * -1.2).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 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 as f32 + PI * 0.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 0.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 amplitude = (speed / 21.0).max(0.25);
let amplitude2 = (speed * 1.4 / 21.0).sqrt().max(0.6);
@ -68,20 +66,12 @@ impl Animation for RunAnimation {
let speedmult = 1.0;
let canceler = (speed / 21.0).sqrt();
let short = (acc_vel * lab as f32 * speedmult).sin();
let short = (acc_vel * lab * speedmult).sin();
//
let shortalt = (acc_vel * lab as f32 * speedmult + PI * 3.0 + 0.7).sin();
let shortalt = (acc_vel * lab * speedmult + PI * 3.0 + 0.7).sin();
let look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.25,
);
let speedadjust = if speed < 5.0 { 0.0 } else { speed / 21.0 };
@ -91,19 +81,19 @@ impl Animation for RunAnimation {
let shift4 = speedadjust - PI * 3.0 / 4.0 + speedadjust * PI / 2.0;
//FL
let foot1a = (acc_vel * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift1).sin();
let foot1b = (acc_vel * lab as f32 * speedmult + 1.1 + canceler * 0.05 + shift1).sin();
let foot1a = (acc_vel * lab * speedmult + 0.0 + canceler * 0.05 + shift1).sin();
let foot1b = (acc_vel * lab * speedmult + 1.1 + canceler * 0.05 + shift1).sin();
//FR
let foot2a = (acc_vel * lab as f32 * speedmult + shift2).sin();
let foot2b = (acc_vel * lab as f32 * speedmult + 1.1 + shift2).sin();
let foot2a = (acc_vel * lab * speedmult + shift2).sin();
let foot2b = (acc_vel * lab * speedmult + 1.1 + shift2).sin();
//BL
let foot3a = (acc_vel * lab as f32 * speedmult + shift3).sin();
let foot3b = (acc_vel * lab as f32 * speedmult + 0.3 + shift3).sin();
let foot3a = (acc_vel * lab * speedmult + shift3).sin();
let foot3b = (acc_vel * lab * speedmult + 0.3 + shift3).sin();
//BR
let foot4a = (acc_vel * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift4).sin();
let foot4b = (acc_vel * lab as f32 * speedmult + 1.57 + canceler * 0.05 + shift4).sin();
let foot4a = (acc_vel * lab * speedmult + 0.0 + canceler * 0.05 + shift4).sin();
let foot4b = (acc_vel * lab * speedmult + 1.57 + canceler * 0.05 + shift4).sin();
//
let slow = (acc_vel * lab as f32 * speedmult + PI).sin();
let slow = (acc_vel * lab * speedmult + PI).sin();
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
@ -119,12 +109,12 @@ impl Animation for RunAnimation {
0.0
} * 1.3;
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 footstrafel = (acc_vel * lab as f32 + PI * 1.45).sin();
let footstrafer = (acc_vel * lab as f32 + PI * (0.95)).sin();
let footvertsl = (acc_vel * lab as f32).sin();
let footvertsr = (acc_vel * lab as f32 + PI * 0.5).sin();
let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm;
let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm;
let footstrafel = (acc_vel * lab + PI * 1.45).sin();
let footstrafer = (acc_vel * lab + PI * (0.95)).sin();
let footvertsl = (acc_vel * lab).sin();
let footvertsr = (acc_vel * lab + PI * 0.5).sin();
let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x;
let side =

View File

@ -10,7 +10,7 @@ impl Animation for ShockwaveAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f64,
f32,
f32,
Option<StageSection>,
);
@ -24,7 +24,7 @@ impl Animation for ShockwaveAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -32,9 +32,9 @@ impl Animation for ShockwaveAnimation {
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};

View File

@ -16,7 +16,7 @@ type ShootAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
f32,
);
@ -40,7 +40,7 @@ impl Animation for ShootAnimation {
stage_section,
acc_vel,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -49,18 +49,16 @@ impl Animation for ShootAnimation {
let mut next = (*skeleton).clone();
let lab = 0.65 * s_a.tempo;
let lab: f32 = 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 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())
* speednorm;
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 footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab + PI * 0.4).sin())
* speednorm;
next.shoulder_l.position = Vec3::new(
@ -92,14 +90,11 @@ impl Animation for ShootAnimation {
match active_tool_kind {
Some(ToolKind::StaffSimple) | Some(ToolKind::Sceptre) => {
let (move1base, move1shake, move2base, move3) = match stage_section {
Some(StageSection::Buildup) => (
anim_time as f32,
(anim_time as f32 * 10.0 + PI).sin(),
0.0,
0.0,
),
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => {
(anim_time, (anim_time * 10.0 + PI).sin(), 0.0, 0.0)
},
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;
@ -146,9 +141,9 @@ impl Animation for ShootAnimation {
},
Some(ToolKind::BowSimple) => {
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)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;
@ -191,9 +186,9 @@ impl Animation for ShootAnimation {
},
Some(ToolKind::Unique(UniqueKind::WendigoMagic)) => {
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)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;

View File

@ -11,7 +11,7 @@ impl Animation for SpinAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = BipedLargeSkeleton;
@ -23,31 +23,29 @@ impl Animation for SpinAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let lab = 1.0;
let lab: f32 = 1.0;
let (movement1, movement2, movement3) = 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).powf(1.8), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powf(1.8), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
let foot = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 10.32).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 10.32).sin());
let foot = ((5.0 / (1.1 + 3.9 * ((anim_time * lab * 10.32).sin()).powi(2))).sqrt())
* ((anim_time * lab * 10.32).sin());
let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin();
let decel = (anim_time * 16.0 * lab).min(PI / 2.0).sin();
let spin = (anim_time as f32 * 2.8 * lab as f32).sin();
let spinhalf = (anim_time as f32 * 1.4 * lab as f32).sin();
let spin = (anim_time * 2.8 * lab).sin();
let spinhalf = (anim_time * 1.4 * lab).sin();
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);

View File

@ -12,7 +12,7 @@ impl Animation for SpinMeleeAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = BipedLargeSkeleton;
@ -25,41 +25,41 @@ impl Animation for SpinMeleeAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let lab = 1.0;
let lab: f32 = 1.0;
let (_movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};
let speed = Vec2::<f32>::from(velocity).magnitude();
let mut next = (*skeleton).clone();
//torso movement
let xshift = if velocity.z.abs() < 0.1 {
((anim_time as f32 - 1.1) * lab as f32 * 3.0).sin()
((anim_time - 1.1) * lab * 3.0).sin()
} else {
0.0
};
let yshift = if velocity.z.abs() < 0.1 {
((anim_time as f32 - 1.1) * lab as f32 * 3.0 + PI / 2.0).sin()
((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 {
0.5 * ((anim_time as f32).powi(2))
0.5 * (anim_time.powi(2))
} else {
lab as f32 * anim_time as f32 * 0.9
lab * anim_time * 0.9
};
//feet
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
let quick = (anim_time as f32 * lab as f32 * 8.0).sin();
let slowersmooth = (anim_time * lab * 4.0).sin();
let quick = (anim_time * lab * 8.0).sin();
match active_tool_kind {
Some(ToolKind::Sword) => {
@ -111,8 +111,8 @@ impl Animation for SpinMeleeAnimation {
* Quaternion::rotation_x(0.7)
* Quaternion::rotation_y(0.0);
next.torso.position = Vec3::new(
-xshift * (anim_time as f32).min(0.6),
-yshift * (anim_time as f32).min(0.6),
-xshift * anim_time.min(0.6),
-yshift * anim_time.min(0.6),
0.0,
);
next.torso.orientation = Quaternion::rotation_z(spin * -16.0)

View File

@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct WieldAnimation;
impl Animation for WieldAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, Vec3<f32>, f64, f32);
type Dependency = (Option<ToolKind>, Option<ToolKind>, Vec3<f32>, f32, f32);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,52 +18,34 @@ impl Animation for WieldAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, velocity, global_time, acc_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab = 0.65 * s_a.tempo; //.65
let torso = (anim_time as f32 * lab as f32 + 1.5 * PI).sin();
let lab: f32 = 0.65 * s_a.tempo; //.65
let torso = (anim_time * lab + 1.5 * PI).sin();
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 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 as f32 + PI * 0.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 0.4).sin());
let slower = (anim_time as f32 * 1.0 + PI).sin();
let slow = (anim_time as f32 * 3.5 + PI).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 slower = (anim_time * 1.0 + PI).sin();
let slow = (anim_time * 3.5 + PI).sin();
let tailmove = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.25,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.125,
(global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.25,
(global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.125,
);
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25,
);
let breathe = if s_a.beast {
@ -72,23 +54,20 @@ impl Animation for WieldAnimation {
let lenght = 1.5;
let chop = 0.2;
let chop_freq = 60.0;
intensity * (lenght * anim_time as f32).sin()
+ 0.05
* chop
* (anim_time as f32 * chop_freq).sin()
* (anim_time as f32 * lenght).cos()
intensity * (lenght * anim_time).sin()
+ 0.05 * chop * (anim_time * chop_freq).sin() * (anim_time * lenght).cos()
} else {
0.0
};
let footvertl = (anim_time as f32 * 16.0 * lab as f32).sin();
let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).sin();
let handhoril = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin();
let handhorir = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin();
let footvertl = (anim_time * 16.0 * lab).sin();
let footvertr = (anim_time * 16.0 * lab + PI).sin();
let handhoril = (anim_time * 16.0 * lab + PI * 1.4).sin();
let handhorir = (anim_time * 16.0 * lab + PI * 0.4).sin();
let short = (acc_vel * lab as f32).sin() * speednorm;
let short = (acc_vel * lab).sin() * speednorm;
let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin();
let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin();
if s_a.beast {
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);

View File

@ -11,11 +11,11 @@ type AlphaAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
Vec3<f32>,
f32,
Option<StageSection>,
f64,
f32,
);
impl Animation for AlphaAnimation {
@ -39,23 +39,23 @@ impl Animation for AlphaAnimation {
stage_section,
_timer,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let fast = (anim_time as f32 * 10.0).sin();
let fastalt = (anim_time as f32 * 10.0 + PI / 2.0).sin();
let fast = (anim_time * 10.0).sin();
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
let speednorm = speed / 9.4;
let speednormcancel = 1.0 - speednorm;
let anim_time = anim_time.min(1.0);
let (move1base, move2base, move3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;

View File

@ -11,11 +11,11 @@ type DashAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
Vec3<f32>,
f32,
Option<StageSection>,
f64,
f32,
);
impl Animation for DashAnimation {
@ -39,24 +39,24 @@ impl Animation for DashAnimation {
stage_section,
_timer,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let fast = (anim_time as f32 * 10.0).sin();
let fastalt = (anim_time as f32 * 10.0 + PI / 2.0).sin();
let fast = (anim_time * 10.0).sin();
let fastalt = (anim_time * 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),
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, anim_time.powi(4), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - move4;

View File

@ -5,7 +5,7 @@ use super::{
pub struct IdleAnimation;
type IdleAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
type IdleAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>);
impl Animation for IdleAnimation {
type Dependency = IdleAnimationDependency;
@ -19,12 +19,12 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 4.0).sin();
let slow = (anim_time * 4.0).sin();
next.foot_l.scale = Vec3::one() * s_a.scaler / 11.0;
next.foot_r.scale = Vec3::one() * s_a.scaler / 11.0;

View File

@ -6,7 +6,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct RunAnimation;
type RunAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>, f32);
type RunAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>, f32);
impl Animation for RunAnimation {
type Dependency = RunAnimationDependency;
@ -20,7 +20,7 @@ impl Animation for RunAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, global_time, _avg_vel, acc_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -29,34 +29,32 @@ impl Animation for RunAnimation {
*rate = 1.0;
let speednorm = (speed / 9.4).powf(0.4);
let lab = 1.0;
let lab: f32 = 1.0;
let footrotl = (((5.0)
/ (0.5 + (5.5) * ((acc_vel * 1.4 * lab as f32 + PI * 1.4).sin()).powi(2)))
let footrotl = ((5.0 / (0.5 + (5.5) * ((acc_vel * 1.4 * lab + PI * 1.4).sin()).powi(2)))
.sqrt())
* ((acc_vel * 1.4 * lab as f32 + PI * 1.4).sin());
* ((acc_vel * 1.4 * lab + PI * 1.4).sin());
let footrotr = (((5.0)
/ (0.5 + (5.5) * ((acc_vel * 1.4 * lab as f32 + PI * 0.4).sin()).powi(2)))
let footrotr = ((5.0 / (0.5 + (5.5) * ((acc_vel * 1.4 * lab + PI * 0.4).sin()).powi(2)))
.sqrt())
* ((acc_vel * 1.4 * lab as f32 + PI * 0.4).sin());
* ((acc_vel * 1.4 * lab + PI * 0.4).sin());
let shortalter = (acc_vel * lab as f32 * 1.4 + PI / -2.0).sin();
let shortalter = (acc_vel * lab * 1.4 + PI / -2.0).sin();
let foothoril = (acc_vel * 1.4 * lab as f32 + PI * 1.45).sin();
let foothorir = (acc_vel * 1.4 * lab as f32 + PI * (0.45)).sin();
let footstrafel = (acc_vel * 1.4 * lab as f32 + PI * 1.45).sin();
let footstrafer = (acc_vel * 1.4 * lab as f32 + PI * (0.95)).sin();
let foothoril = (acc_vel * 1.4 * lab + PI * 1.45).sin();
let foothorir = (acc_vel * 1.4 * lab + PI * (0.45)).sin();
let footstrafel = (acc_vel * 1.4 * lab + PI * 1.45).sin();
let footstrafer = (acc_vel * 1.4 * lab + PI * (0.95)).sin();
let footvertl = (acc_vel * 1.4 * lab as f32).sin();
let footvertr = (acc_vel * 1.4 * lab as f32 + PI).sin();
let footvertsl = (acc_vel * 1.4 * lab as f32).sin();
let footvertsr = (acc_vel * 1.4 * lab as f32 + PI * 0.5).sin();
let footvertl = (acc_vel * 1.4 * lab).sin();
let footvertr = (acc_vel * 1.4 * lab + PI).sin();
let footvertsl = (acc_vel * 1.4 * lab).sin();
let footvertsr = (acc_vel * 1.4 * lab + PI * 0.5).sin();
let shortalt = (acc_vel * lab as f32 * 1.4 + PI / 2.0).sin();
let shortalt = (acc_vel * lab * 1.4 + PI / 2.0).sin();
let short = (((5.0) / (1.5 + 3.5 * ((acc_vel * lab as f32 * 1.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 * 1.4).sin());
let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.4).sin()).powi(2))).sqrt())
* ((acc_vel * lab * 1.4).sin());
let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x;
let side =
@ -77,16 +75,8 @@ impl Animation for RunAnimation {
} * 1.3;
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(1137.0)
.sin()
* 0.1,
(global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2,
(global_time + anim_time / 18.0).floor().mul(1137.0).sin() * 0.1,
);
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
next.foot_l.scale = Vec3::one() * s_a.scaler / 11.0;

View File

@ -12,11 +12,11 @@ type ShootAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
Vec3<f32>,
f32,
Option<StageSection>,
f64,
f32,
);
impl Animation for ShootAnimation {
@ -41,15 +41,15 @@ impl Animation for ShootAnimation {
stage_section,
_timer,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let fast = (anim_time as f32 * 10.0).sin();
let fastalt = (anim_time as f32 * 10.0 + PI / 2.0).sin();
let fast = (anim_time * 10.0).sin();
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
let speednorm = speed / 9.4;
let speednormcancel = 1.0 - speednorm;
@ -82,9 +82,9 @@ impl Animation for ShootAnimation {
match active_tool_kind {
Some(ToolKind::Bow) => {
let (move1base, move2base, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;
@ -113,9 +113,9 @@ impl Animation for ShootAnimation {
},
Some(ToolKind::Staff) | Some(ToolKind::StaffSimple) => {
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).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;

View File

@ -12,7 +12,7 @@ type WieldAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
Vec3<f32>,
f32,
);
@ -29,7 +29,7 @@ impl Animation for WieldAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, velocity, _orientation, _last_ori, _global_time, _avg_vel, acc_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -37,9 +37,9 @@ impl Animation for WieldAnimation {
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 slow = (anim_time as f32 * 2.0).sin();
let fast = (anim_time * 10.0).sin();
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
let slow = (anim_time * 2.0).sin();
let speednorm = speed / 9.4;
let speednormcancel = 1.0 - speednorm;

View File

@ -7,7 +7,7 @@ use std::ops::Mul;
pub struct FeedAnimation;
impl Animation for FeedAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = BirdMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,28 +18,20 @@ impl Animation for FeedAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave = (anim_time as f32 * 8.0).sin();
let wave_slow = (anim_time * 4.5).sin();
let wave = (anim_time * 8.0).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let wave_slow_cos = (anim_time * 4.5).cos();
let duck_head_look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25,
);
next.head.position = Vec3::new(0.0, s_a.head.0 + 1.0, -2.0 + s_a.head.1);

View File

@ -7,7 +7,7 @@ use std::f32::consts::PI;
pub struct FlyAnimation;
impl Animation for FlyAnimation {
type Dependency = (f32, f64);
type Dependency = (f32, f32);
type Skeleton = BirdMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,18 +17,18 @@ impl Animation for FlyAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 12.0; //14.0
let lab: f32 = 12.0; //14.0
let footl = (anim_time as f32 * lab as f32 + PI).sin();
let footr = (anim_time as f32 * lab as f32).sin();
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
let footl = (anim_time * lab + PI).sin();
let footr = (anim_time * lab).sin();
let center = (anim_time * lab + PI / 2.0).sin();
let centeroffset = (anim_time * lab + PI * 1.5).sin();
next.torso.scale = Vec3::one() / 11.0;
next.wing_l.scale = Vec3::one() * 1.05;

View File

@ -7,7 +7,7 @@ use std::ops::Mul;
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = BirdMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,26 +18,18 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let wave_slow = (anim_time * 4.5).sin();
let wave_slow_cos = (anim_time * 4.5).cos();
let duck_head_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25,
);
next.torso.scale = Vec3::one() / 11.0;

View File

@ -7,7 +7,7 @@ use std::f32::consts::PI;
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency = (f32, f64);
type Dependency = (f32, f32);
type Skeleton = BirdMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,18 +17,18 @@ impl Animation for RunAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, _global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 16.0; //14.0
let lab: f32 = 16.0; //14.0
let footl = (anim_time as f32 * lab as f32 + PI).sin();
let footr = (anim_time as f32 * lab as f32).sin();
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
let footl = (anim_time * lab + PI).sin();
let footr = (anim_time * lab).sin();
let center = (anim_time * lab + PI / 2.0).sin();
let centeroffset = (anim_time * lab + PI * 1.5).sin();
next.torso.scale = Vec3::one() / 11.0;
next.wing_l.scale = Vec3::one() * 1.05;

View File

@ -5,7 +5,7 @@ use super::super::vek::*;
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = BirdSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -15,7 +15,7 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -5,7 +5,7 @@ use super::super::vek::*;
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = (f32, f64);
type Dependency = (f32, f32);
type Skeleton = BirdSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -15,7 +15,7 @@ impl Animation for JumpAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -5,7 +5,7 @@ use super::super::vek::*;
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency = (f32, f64);
type Dependency = (f32, f32);
type Skeleton = BirdSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -15,7 +15,7 @@ impl Animation for RunAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, _global_time): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -12,7 +12,7 @@ impl Animation for AlphaAnimation {
Option<ToolKind>,
Option<ToolKind>,
f32,
f64,
f32,
Option<StageSection>,
);
type Skeleton = CharacterSkeleton;
@ -25,7 +25,7 @@ impl Animation for AlphaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -33,9 +33,9 @@ impl Animation for AlphaAnimation {
let mut next = (*skeleton).clone();
let (move1, move2, 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)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
@ -89,9 +89,9 @@ impl Animation for AlphaAnimation {
Vec3::new(0. + move2 * 2.0, s_a.head.0 + move2 * 2.0, s_a.head.1);
let (move1, move2, 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)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(
@ -118,9 +118,9 @@ impl Animation for AlphaAnimation {
},
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) => {
let (move1, move2, 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)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.main.position = Vec3::new(0.0, 0.0, 0.0);

View File

@ -11,7 +11,7 @@ impl Animation for BeamAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f64,
f32,
f32,
Option<StageSection>,
);
@ -25,7 +25,7 @@ impl Animation for BeamAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -33,9 +33,9 @@ impl Animation for BeamAnimation {
let mut next = (*skeleton).clone();
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Cast) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Cast) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};

View File

@ -11,7 +11,7 @@ impl Animation for BetaAnimation {
Option<ToolKind>,
Option<ToolKind>,
f32,
f64,
f32,
Option<StageSection>,
);
type Skeleton = CharacterSkeleton;
@ -23,7 +23,7 @@ impl Animation for BetaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -31,9 +31,9 @@ impl Animation for BetaAnimation {
let mut next = (*skeleton).clone();
let (move1, move2, 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)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};

View File

@ -7,7 +7,7 @@ use common::comp::item::ToolKind;
pub struct BlockAnimation;
impl Animation for BlockAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,7 +17,7 @@ impl Animation for BlockAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, _global_time): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -10,7 +10,7 @@ impl Animation for ChargeswingAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = CharacterSkeleton;
@ -23,36 +23,29 @@ impl Animation for ChargeswingAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let lab = 1.0;
let lab: f32 = 1.0;
let short = (((5.0) / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 8.0).sin());
let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt())
* ((anim_time * lab * 8.0).sin());
// end spin stuff
let (move1base, move2base, move3, tension, test) = match stage_section {
Some(StageSection::Charge) => (
(anim_time as f32).min(1.0),
anim_time.min(1.0),
0.0,
0.0,
(anim_time as f32 * 18.0 * lab as f32).sin(),
(anim_time * 18.0 * lab).sin(),
0.0,
),
Some(StageSection::Swing) => (
1.0,
(anim_time as f32).powf(0.25),
0.0,
0.0,
(anim_time as f32).powi(4),
),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4), 0.0, 1.0),
Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0, 0.0, anim_time.powi(4)),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 0.0, 1.0),
_ => (0.0, 0.0, 0.0, 0.0, 0.0),
};
let move1 = move1base * (1.0 - move3);

View File

@ -13,7 +13,7 @@ impl Animation for ClimbAnimation {
Option<ToolKind>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
);
type Skeleton = CharacterSkeleton;
@ -24,7 +24,7 @@ impl Animation for ClimbAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, velocity, _orientation, global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -32,31 +32,20 @@ impl Animation for ClimbAnimation {
let lateral = Vec2::<f32>::from(velocity).magnitude();
let speed = velocity.z;
*rate = speed;
let constant = 1.0;
let smooth = (anim_time as f32 * constant as f32 * 1.5).sin();
let smootha = (anim_time as f32 * constant as f32 * 1.5 + PI / 2.0).sin();
let drop = (anim_time as f32 * constant as f32 * 4.0 + PI / 2.0).sin();
let dropa = (anim_time as f32 * constant as f32 * 4.0).sin();
let constant: f32 = 1.0;
let smooth = (anim_time * constant * 1.5).sin();
let smootha = (anim_time * constant * 1.5 + PI / 2.0).sin();
let drop = (anim_time * constant * 4.0 + PI / 2.0).sin();
let dropa = (anim_time * constant * 4.0).sin();
let quick = (((5.0)
/ (0.6 + 4.0 * ((anim_time as f32 * constant as f32 * 1.5).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * constant as f32 * 1.5).sin());
let quicka = (((5.0)
/ (0.6 + 4.0 * ((anim_time as f32 * constant as f32 * 1.5 + PI / 2.0).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * constant as f32 * 1.5 + PI / 2.0).sin());
let quick = ((5.0 / (0.6 + 4.0 * ((anim_time * constant * 1.5).sin()).powi(2))).sqrt())
* ((anim_time * constant * 1.5).sin());
let quicka =
((5.0 / (0.6 + 4.0 * ((anim_time * constant * 1.5 + PI / 2.0).sin()).powi(2))).sqrt())
* ((anim_time * constant * 1.5 + PI / 2.0).sin());
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.3,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.15,
(global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.3,
(global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.15,
);
let stagnant = if speed > -0.7 { 1.0 } else { 0.0 }; //sets static position when there is no movement

View File

@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct DanceAnimation;
impl Animation for DanceAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,7 +18,7 @@ impl Animation for DanceAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -26,33 +26,22 @@ impl Animation for DanceAnimation {
*rate = 1.0;
let lab = 1.0;
let short = (((5.0) / (3.0 + 2.0 * ((anim_time as f32 * lab as f32 * 6.0).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 6.0).sin());
let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin();
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
let lab: f32 = 1.0;
let short = ((5.0 / (3.0 + 2.0 * ((anim_time * lab * 6.0).sin()).powi(2))).sqrt())
* ((anim_time * lab * 6.0).sin());
let noisea = (anim_time * 11.0 + PI / 6.0).sin();
let noiseb = (anim_time * 19.0 + PI / 4.0).sin();
let shorte = (anim_time as f32 * lab as f32 * 6.0).sin();
let shorte = (anim_time * lab * 6.0).sin();
let shortealt = (anim_time as f32 * lab as f32 * 6.0 + PI / 2.0).sin();
let shortealt = (anim_time * lab * 6.0 + PI / 2.0).sin();
let foot = (((5.0)
/ (1.0 + (4.0) * ((anim_time as f32 * lab as f32 * 8.0).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 8.0).sin());
let foot = ((5.0 / (1.0 + (4.0) * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt())
* ((anim_time * lab * 8.0).sin());
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 6.0)
.floor()
.mul(7331.0)
.sin()
* 0.3,
((global_time + anim_time) as f32 / 6.0)
.floor()
.mul(1337.0)
.sin()
* 0.15,
(global_time + anim_time / 6.0).floor().mul(7331.0).sin() * 0.3,
(global_time + anim_time / 6.0).floor().mul(1337.0).sin() * 0.15,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);

View File

@ -11,7 +11,7 @@ impl Animation for DashAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = CharacterSkeleton;
@ -24,7 +24,7 @@ impl Animation for DashAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -32,19 +32,19 @@ impl Animation for DashAnimation {
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3, movement4) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.01), 0.0),
Some(StageSection::Recover) => (1.1, 1.0, 1.0, (anim_time as f32).powi(4)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.01), 0.0),
Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0, 0.0),
};
fn slow(x: f32) -> f32 {
(((5.0) / (1.1 + 3.9 * ((x * 12.4).sin()).powi(2))).sqrt()) * ((x * 12.4).sin())
((5.0 / (1.1 + 3.9 * ((x * 12.4).sin()).powi(2))).sqrt()) * ((x * 12.4).sin())
}
fn short(x: f32) -> f32 {
(((5.0) / (1.5 + 3.5 * ((x * 5.0).sin()).powi(2))).sqrt()) * ((x * 5.0).sin())
((5.0 / (1.5 + 3.5 * ((x * 5.0).sin()).powi(2))).sqrt()) * ((x * 5.0).sin())
}
fn shortalt(x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
@ -104,8 +104,8 @@ impl Animation for DashAnimation {
_ => {},
}
next.lantern.orientation = Quaternion::rotation_x(slow(anim_time as f32) * -0.7 + 0.4)
* Quaternion::rotation_y(slow(anim_time as f32) * 0.4);
next.lantern.orientation = Quaternion::rotation_x(slow(anim_time) * -0.7 + 0.4)
* Quaternion::rotation_y(slow(anim_time) * 0.4);
next
}

View File

@ -8,7 +8,7 @@ use std::f32::consts::PI;
pub struct EquipAnimation;
impl Animation for EquipAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f32);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -19,14 +19,14 @@ impl Animation for EquipAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let equip_slow = 1.0 + (anim_time as f32 * 12.0 + PI).cos();
let equip_slowa = 1.0 + (anim_time as f32 * 12.0 + PI / 4.0).cos();
let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos();
let equip_slowa = 1.0 + (anim_time * 12.0 + PI / 4.0).cos();
next.hand_l.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57);
next.hand_r.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57);
next.control.position = Vec3::new(equip_slowa * -1.5, 0.0, equip_slow * 1.5);

View File

@ -12,7 +12,7 @@ type GlideWieldAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
);
impl Animation for GlideWieldAnimation {
@ -27,7 +27,7 @@ impl Animation for GlideWieldAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, velocity, _orientation, _last_ori, _global_time): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -13,7 +13,7 @@ type GlidingAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
);
impl Animation for GlidingAnimation {
@ -28,7 +28,7 @@ impl Animation for GlidingAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -36,24 +36,16 @@ impl Animation for GlidingAnimation {
let speed = Vec2::<f32>::from(velocity).magnitude();
let quick = (anim_time as f32 * 7.0).sin();
let quicka = (anim_time as f32 * 7.0 + PI / 2.0).sin();
let wave_stop = (anim_time as f32 * 1.5).min(PI / 2.0).sin();
let slow = (anim_time as f32 * 3.0).sin();
let slowb = (anim_time as f32 * 3.0 + PI).sin();
let slowa = (anim_time as f32 * 3.0 + PI / 2.0).sin();
let quick = (anim_time * 7.0).sin();
let quicka = (anim_time * 7.0 + PI / 2.0).sin();
let wave_stop = (anim_time * 1.5).min(PI / 2.0).sin();
let slow = (anim_time * 3.0).sin();
let slowb = (anim_time * 3.0 + PI).sin();
let slowa = (anim_time * 3.0 + PI / 2.0).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 4.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 4.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 4.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 4.0).floor().mul(1337.0).sin() * 0.25,
);
let ori: Vec2<f32> = Vec2::from(orientation);
@ -70,11 +62,7 @@ impl Animation for GlidingAnimation {
0.0
};
let tiltcancel = if anim_time > 1.0 {
1.0
} else {
anim_time as f32
};
let tiltcancel = if anim_time > 1.0 { 1.0 } else { anim_time };
next.head.position = Vec3::new(0.0, s_a.head.0 + 1.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(0.35 - slow * 0.10 + head_look.y)

View File

@ -13,7 +13,7 @@ impl Animation for IdleAnimation {
Option<ToolKind>,
Option<ToolKind>,
(Option<Hands>, Option<Hands>),
f64,
f32,
);
type Skeleton = CharacterSkeleton;
@ -24,24 +24,16 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, second_tool_kind, hands, global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 1.0).sin();
let slow = (anim_time * 1.0).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 12.0)
.floor()
.mul(7331.0)
.sin()
* 0.1,
((global_time + anim_time) as f32 / 12.0)
.floor()
.mul(1337.0)
.sin()
* 0.05,
(global_time + anim_time / 12.0).floor().mul(7331.0).sin() * 0.1,
(global_time + anim_time / 12.0).floor().mul(1337.0).sin() * 0.05,
);
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.scale = Vec3::one() * 1.01;

View File

@ -15,7 +15,7 @@ impl Animation for JumpAnimation {
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
);
type Skeleton = CharacterSkeleton;
@ -27,17 +27,15 @@ impl Animation for JumpAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, second_tool_kind, hands, velocity, orientation, last_ori, global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 7.0).sin();
let slow = (anim_time * 7.0).sin();
let random = ((((2.0
* ((global_time as f32 - anim_time as f32)
- ((global_time as f32 - anim_time as f32).round())))
.abs())
let random =
((((2.0 * ((global_time - anim_time) - ((global_time - anim_time).round()))).abs())
* 10.0)
.round())
/ 10.0;

View File

@ -11,7 +11,7 @@ impl Animation for LeapAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = CharacterSkeleton;
@ -24,7 +24,7 @@ impl Animation for LeapAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -32,10 +32,10 @@ impl Animation for LeapAnimation {
let mut next = (*skeleton).clone();
let (move1, move2, move3, move4) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, (anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0, 0.0),
};

View File

@ -10,7 +10,7 @@ impl Animation for RepeaterAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = CharacterSkeleton;
@ -23,7 +23,7 @@ impl Animation for RepeaterAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -31,10 +31,10 @@ impl Animation for RepeaterAnimation {
let mut next = (*skeleton).clone();
let (move1, move2, move3, _move4) = match stage_section {
Some(StageSection::Movement) => (anim_time as f32, 0.0, 0.0, 0.0),
Some(StageSection::Buildup) => (1.0, anim_time as f32, 0.0, 0.0),
Some(StageSection::Shoot) => (1.0, 1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time as f32),
Some(StageSection::Movement) => (anim_time, 0.0, 0.0, 0.0),
Some(StageSection::Buildup) => (1.0, anim_time, 0.0, 0.0),
Some(StageSection::Shoot) => (1.0, 1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0, 0.0),
};

View File

@ -12,7 +12,7 @@ type RollAnimationDependency = (
Option<ToolKind>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
);
@ -28,7 +28,7 @@ impl Animation for RollAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, orientation, last_ori, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -50,9 +50,9 @@ impl Animation for RollAnimation {
};
let (movement1base, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(2.0), 0.0, 0.0),
Some(StageSection::Movement) => (1.0, (anim_time as f32).powf(0.75), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(0.75)),
Some(StageSection::Buildup) => (anim_time.powf(2.0), 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time.powf(0.75), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(0.75)),
_ => (0.0, 0.0, 0.0),
};
let movement1 = movement1base * (1.0 - movement3);

View File

@ -14,7 +14,7 @@ type RunAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
Vec3<f32>,
f32,
);
@ -41,7 +41,7 @@ impl Animation for RunAnimation {
avg_vel,
acc_vel,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -52,40 +52,38 @@ impl Animation for RunAnimation {
let impact = (avg_vel.z).max(-8.0);
let speednorm = (speed / 9.4).powf(0.6);
let lab = 1.0;
let lab: f32 = 1.0;
let footrotl = (((1.0)
/ (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin()).powi(2)))
let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * 1.6 * lab + PI * 1.4).sin()).powi(2)))
.sqrt())
* ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin());
* ((acc_vel * 1.6 * lab + PI * 1.4).sin());
let footrotr = (((1.0)
/ (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin()).powi(2)))
let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * 1.6 * lab + PI * 0.4).sin()).powi(2)))
.sqrt())
* ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin());
* ((acc_vel * 1.6 * lab + PI * 0.4).sin());
let noisea = (acc_vel * 11.0 + PI / 6.0).sin();
let noiseb = (acc_vel * 19.0 + PI / 4.0).sin();
let shorte = (((1.0) / (0.8 + 0.2 * ((acc_vel * lab as f32 * 1.6).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 * 1.6).sin());
let shorte = ((1.0 / (0.8 + 0.2 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
* ((acc_vel * lab * 1.6).sin());
let shortalter = (acc_vel * lab as f32 * 1.6 + PI / -2.0).sin();
let shortalter = (acc_vel * lab * 1.6 + PI / -2.0).sin();
let foothoril = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin();
let foothorir = (acc_vel * 1.6 * lab as f32 + PI * (0.45)).sin();
let footstrafel = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin();
let footstrafer = (acc_vel * 1.6 * lab as f32 + PI * (0.95)).sin();
let foothoril = (acc_vel * 1.6 * lab + PI * 1.45).sin();
let foothorir = (acc_vel * 1.6 * lab + PI * (0.45)).sin();
let footstrafel = (acc_vel * 1.6 * lab + PI * 1.45).sin();
let footstrafer = (acc_vel * 1.6 * lab + PI * (0.95)).sin();
let footvertl = (acc_vel * 1.6 * lab as f32).sin();
let footvertr = (acc_vel * 1.6 * lab as f32 + PI).sin();
let footvertsl = (acc_vel * 1.6 * lab as f32).sin();
let footvertsr = (acc_vel * 1.6 * lab as f32 + PI * 0.5).sin();
let footvertl = (acc_vel * 1.6 * lab).sin();
let footvertr = (acc_vel * 1.6 * lab + PI).sin();
let footvertsl = (acc_vel * 1.6 * lab).sin();
let footvertsr = (acc_vel * 1.6 * lab + PI * 0.5).sin();
let shortalt = (acc_vel * lab as f32 * 1.6 + PI / 2.0).sin();
let shortalt = (acc_vel * lab * 1.6 + PI / 2.0).sin();
let short = (((5.0) / (1.5 + 3.5 * ((acc_vel * lab as f32 * 1.6).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 * 1.6).sin());
let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
* ((acc_vel * lab * 1.6).sin());
let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x;
let side =
@ -107,16 +105,8 @@ impl Animation for RunAnimation {
//println!("speednorm {} ",side);
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
(global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2,
(global_time + anim_time / 18.0).floor().mul(1337.0).sin() * 0.1,
);
next.head.position = Vec3::new(0.0, 1.0 * speednorm + s_a.head.0, s_a.head.1 + short * 0.1);

View File

@ -13,7 +13,7 @@ impl Animation for ShockwaveAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f64,
f32,
f32,
Option<StageSection>,
);
@ -27,7 +27,7 @@ impl Animation for ShockwaveAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -35,9 +35,9 @@ impl Animation for ShockwaveAnimation {
let mut next = (*skeleton).clone();
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};

View File

@ -14,7 +14,7 @@ type ShootAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Dir,
f64,
f32,
Option<StageSection>,
);
impl Animation for ShootAnimation {
@ -38,7 +38,7 @@ impl Animation for ShootAnimation {
_global_time,
stage_section,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -47,7 +47,7 @@ impl Animation for ShootAnimation {
let mut next = (*skeleton).clone();
let lab = 1.0;
let lab: f32 = 1.0;
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
let tilt = if ::vek::Vec2::new(ori, last_ori)
@ -64,13 +64,13 @@ impl Animation for ShootAnimation {
match active_tool_kind {
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Shoot) => (1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Shoot) => (1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};
let xmove = (move1 as f32 * 6.0 * lab as f32 + PI).sin();
let ymove = (move1 as f32 * 6.0 * lab as f32 + PI * (0.5)).sin();
let xmove = (move1 * 6.0 * lab + PI).sin();
let ymove = (move1 * 6.0 * lab + PI * (0.5)).sin();
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
@ -118,9 +118,9 @@ impl Animation for ShootAnimation {
},
Some(ToolKind::Bow) => {
let (_move1, move2, _move3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Shoot) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Shoot) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
next.main.position = Vec3::new(0.0, 0.0, 0.0);
@ -151,7 +151,7 @@ impl Animation for ShootAnimation {
next.head.position = Vec3::new(0.0 - 2.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(look_dir.z * 0.7)
* Quaternion::rotation_z(tilt * -2.5 - 0.5 + (move2 as f32 * -0.2).sin());
* Quaternion::rotation_z(tilt * -2.5 - 0.5 + (move2 * -0.2).sin());
next.chest.orientation = Quaternion::rotation_z(0.8 + move2 * 0.2);
next.belt.orientation = Quaternion::rotation_z(move2 * 0.3);
next.shorts.orientation = Quaternion::rotation_z(move2 * 0.5);

View File

@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct SitAnimation;
impl Animation for SitAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,27 +18,19 @@ impl Animation for SitAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 1.0).sin();
let slowa = (anim_time as f32 * 1.0 + PI / 2.0).sin();
let stop = (anim_time as f32 * 3.0).min(PI / 2.0).sin();
let slow = (anim_time * 1.0).sin();
let slowa = (anim_time * 1.0 + PI / 2.0).sin();
let stop = (anim_time * 3.0).min(PI / 2.0).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(7331.0)
.sin()
* 0.25,
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(1337.0)
.sin()
* 0.125,
(global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.25,
(global_time + anim_time / 18.0).floor().mul(1337.0).sin() * 0.125,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * 0.1 + stop * -0.8);
next.head.orientation = Quaternion::rotation_z(head_look.x + slow * 0.2 - slow * 0.1)

View File

@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct SneakAnimation;
impl Animation for SneakAnimation {
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, f64);
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, f32);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -19,56 +19,45 @@ impl Animation for SneakAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = 1.0;
let slow = (anim_time as f32 * 3.0).sin();
let breathe = ((anim_time as f32 * 0.5).sin()).abs();
let slow = (anim_time * 3.0).sin();
let breathe = ((anim_time * 0.5).sin()).abs();
let walkintensity = if speed > 5.0 { 1.0 } else { 0.45 };
let lower = if speed > 5.0 { 0.0 } else { 1.0 };
let _snapfoot = if speed > 5.0 { 1.1 } else { 2.0 };
let lab = 1.0;
let foothoril = (anim_time as f32 * 7.0 * lab as f32 + PI * 1.45).sin();
let foothorir = (anim_time as f32 * 7.0 * lab as f32 + PI * (0.45)).sin();
let lab: f32 = 1.0;
let foothoril = (anim_time * 7.0 * lab + PI * 1.45).sin();
let foothorir = (anim_time * 7.0 * lab + PI * (0.45)).sin();
let footvertl = (anim_time as f32 * 7.0 * lab as f32).sin();
let footvertr = (anim_time as f32 * 7.0 * lab as f32 + PI).sin();
let footvertl = (anim_time * 7.0 * lab).sin();
let footvertr = (anim_time * 7.0 * lab + PI).sin();
let footrotl = (((5.0)
/ (2.5 + (2.5) * ((anim_time as f32 * 7.0 * lab as f32 + PI * 1.4).sin()).powi(2)))
let footrotl = ((5.0 / (2.5 + (2.5) * ((anim_time * 7.0 * lab + PI * 1.4).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 7.0 * lab as f32 + PI * 1.4).sin());
* ((anim_time * 7.0 * lab + PI * 1.4).sin());
let footrotr = (((5.0)
/ (1.0 + (4.0) * ((anim_time as f32 * 7.0 * lab as f32 + PI * 0.4).sin()).powi(2)))
let footrotr = ((5.0 / (1.0 + (4.0) * ((anim_time * 7.0 * lab + PI * 0.4).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 7.0 * lab as f32 + PI * 0.4).sin());
* ((anim_time * 7.0 * lab + PI * 0.4).sin());
let short = (anim_time as f32 * lab as f32 * 7.0).sin();
let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin();
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
let short = (anim_time * lab * 7.0).sin();
let noisea = (anim_time * 11.0 + PI / 6.0).sin();
let noiseb = (anim_time * 19.0 + PI / 4.0).sin();
let shorte =
(((5.0) / (4.0 + 1.0 * ((anim_time as f32 * lab as f32 * 7.0).sin()).powi(2))).sqrt())
* ((anim_time as f32 * lab as f32 * 7.0).sin());
let shorte = ((5.0 / (4.0 + 1.0 * ((anim_time * lab * 7.0).sin()).powi(2))).sqrt())
* ((anim_time * lab * 7.0).sin());
let shortalt = (anim_time as f32 * lab as f32 * 7.0 + PI / 2.0).sin();
let shortalt = (anim_time * lab * 7.0 + PI / 2.0).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
(global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2,
(global_time + anim_time / 18.0).floor().mul(1337.0).sin() * 0.1,
);
let orientation: Vec2<f32> = Vec2::from(orientation);

View File

@ -12,7 +12,7 @@ impl Animation for SpinAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = CharacterSkeleton;
@ -24,7 +24,7 @@ impl Animation for SpinAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -32,9 +32,9 @@ impl Animation for SpinAnimation {
let mut next = (*skeleton).clone();
let (movement1base, movement2base, movement3) = 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)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
@ -101,9 +101,9 @@ impl Animation for SpinAnimation {
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
let (movement1, movement2, movement3) = 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)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};

View File

@ -12,7 +12,7 @@ impl Animation for SpinMeleeAnimation {
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = CharacterSkeleton;
@ -25,15 +25,15 @@ impl Animation for SpinMeleeAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let (move1, move2, 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).powf(4.0)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
_ => (0.0, 0.0, 0.0),
};
let mut next = (*skeleton).clone();

View File

@ -11,9 +11,9 @@ impl Animation for StaggeredAnimation {
Option<ToolKind>,
Option<ToolKind>,
f32,
f64,
f32,
Option<StageSection>,
f64,
f32,
bool,
);
type Skeleton = CharacterSkeleton;
@ -34,7 +34,7 @@ impl Animation for StaggeredAnimation {
timer,
wield_status,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -42,14 +42,14 @@ impl Animation for StaggeredAnimation {
let mut next = (*skeleton).clone();
let (movement1base, movement2) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, (anim_time as f32).powf(4.0)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, anim_time.powf(4.0)),
_ => (0.0, 0.0),
};
let pullback = 1.0 - movement2;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let mirror = (check - 0.5).signum();
let movement1 = movement1base * pullback * mirror;
let movement1abs = movement1base * pullback;

View File

@ -13,7 +13,7 @@ impl Animation for StandAnimation {
Option<ToolKind>,
Option<ToolKind>,
(Option<Hands>, Option<Hands>),
f64,
f32,
Vec3<f32>,
);
type Skeleton = CharacterSkeleton;
@ -25,25 +25,17 @@ impl Animation for StandAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, second_tool_kind, hands, global_time, avg_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 1.0).sin();
let slow = (anim_time * 1.0).sin();
let impact = (avg_vel.z).max(-15.0);
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 12.0)
.floor()
.mul(7331.0)
.sin()
* 0.3,
((global_time + anim_time) as f32 / 12.0)
.floor()
.mul(1337.0)
.sin()
* 0.15,
(global_time + anim_time / 12.0).floor().mul(7331.0).sin() * 0.3,
(global_time + anim_time / 12.0).floor().mul(1337.0).sin() * 0.15,
);
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.scale = Vec3::one() * 1.01;

View File

@ -11,9 +11,9 @@ impl Animation for StunnedAnimation {
Option<ToolKind>,
Option<ToolKind>,
f32,
f64,
f32,
Option<StageSection>,
f64,
f32,
bool,
);
type Skeleton = CharacterSkeleton;
@ -34,7 +34,7 @@ impl Animation for StunnedAnimation {
timer,
wield_status,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -42,14 +42,14 @@ impl Animation for StunnedAnimation {
let mut next = (*skeleton).clone();
let (movement1base, movement2) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, (anim_time as f32).powf(4.0)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, anim_time.powf(4.0)),
_ => (0.0, 0.0),
};
let pullback = 1.0 - movement2;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let mirror = (check - 0.5).signum();
let movement1 = movement1base * pullback * mirror;
let movement1abs = movement1base * pullback;

View File

@ -14,7 +14,7 @@ type SwimAnimationDependency = (
Vec3<f32>,
Vec3<f32>,
Vec3<f32>,
f64,
f32,
Vec3<f32>,
);
@ -39,7 +39,7 @@ impl Animation for SwimAnimation {
global_time,
avg_vel,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -53,31 +53,29 @@ impl Animation for SwimAnimation {
let tempo = if speed > 0.5 { 1.5 } else { 0.7 };
let intensity = if speed > 0.5 { 1.0 } else { 0.3 };
let lab = 1.0 * tempo;
let lab: f32 = 1.0 * tempo;
let short = (anim_time as f32 * lab as f32 * 6.0 + PI * 0.9).sin();
let short = (anim_time * lab * 6.0 + PI * 0.9).sin();
let foot = (anim_time as f32 * lab as f32 * 6.0 + PI * -0.1).sin();
let foot = (anim_time * lab * 6.0 + PI * -0.1).sin();
let footrotl = (((1.0)
/ (0.2 + (0.8) * ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin()).powi(2)))
let footrotl = ((1.0 / (0.2 + (0.8) * ((anim_time * 6.0 * lab + PI * 1.4).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin());
* ((anim_time * 6.0 * lab + PI * 1.4).sin());
let footrotr = (((1.0)
/ (0.2 + (0.8) * ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin()).powi(2)))
let footrotr = ((1.0 / (0.2 + (0.8) * ((anim_time * 6.0 * lab + PI * 0.4).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin());
* ((anim_time * 6.0 * lab + PI * 0.4).sin());
let foothoril = (anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin();
let foothorir = (anim_time as f32 * 6.0 * lab as f32 + PI * (0.4)).sin();
let foothoril = (anim_time * 6.0 * lab + PI * 1.4).sin();
let foothorir = (anim_time * 6.0 * lab + PI * (0.4)).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 4.0 * (1.0 / tempo))
(global_time + anim_time / 4.0 * (1.0 / tempo))
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 4.0 * (1.0 / tempo))
(global_time + anim_time / 4.0 * (1.0 / tempo))
.floor()
.mul(1337.0)
.sin()

View File

@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct SwimWieldAnimation;
impl Animation for SwimWieldAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f32);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -19,49 +19,38 @@ impl Animation for SwimWieldAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, velocity, global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
*rate = 1.0;
let lab = 1.0;
let lab: f32 = 1.0;
let speed = Vec3::<f32>::from(velocity).magnitude();
*rate = 1.0;
let intensity = if speed > 0.5 { 1.0 } else { 0.3 };
let footrotl = (((1.0)
/ (0.2 + (0.8) * ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin()).powi(2)))
let footrotl = ((1.0 / (0.2 + (0.8) * ((anim_time * 6.0 * lab + PI * 1.4).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin());
* ((anim_time * 6.0 * lab + PI * 1.4).sin());
let footrotr = (((1.0)
/ (0.2 + (0.8) * ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin()).powi(2)))
let footrotr = ((1.0 / (0.2 + (0.8) * ((anim_time * 6.0 * lab + PI * 0.4).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin());
* ((anim_time * 6.0 * lab + PI * 0.4).sin());
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 3.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 3.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
(global_time + anim_time / 3.0).floor().mul(7331.0).sin() * 0.2,
(global_time + anim_time / 3.0).floor().mul(1337.0).sin() * 0.1,
);
let slowalt = (anim_time as f32 * 6.0 + PI).cos();
let u_slow = (anim_time as f32 * 1.0 + PI).sin();
let foothoril = (anim_time as f32 * 6.0 * lab as f32 + PI * 1.45).sin();
let foothorir = (anim_time as f32 * 6.0 * lab as f32 + PI * (0.45)).sin();
let u_slowalt = (anim_time as f32 * 3.0 + PI).cos();
let short =
(((5.0) / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powi(2))).sqrt())
* ((anim_time as f32 * lab as f32 * 16.0).sin());
let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin();
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
let slowalt = (anim_time * 6.0 + PI).cos();
let u_slow = (anim_time * 1.0 + PI).sin();
let foothoril = (anim_time * 6.0 * lab + PI * 1.45).sin();
let foothorir = (anim_time * 6.0 * lab + PI * (0.45)).sin();
let u_slowalt = (anim_time * 3.0 + PI).cos();
let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 16.0).sin()).powi(2))).sqrt())
* ((anim_time * lab * 16.0).sin());
let noisea = (anim_time * 11.0 + PI / 6.0).sin();
let noiseb = (anim_time * 19.0 + PI / 4.0).sin();
next.foot_l.position = Vec3::new(
-s_a.foot.0,

View File

@ -8,7 +8,7 @@ use std::f32::consts::PI;
pub struct TalkAnimation;
impl Animation for TalkAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f64, Dir);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f32, Dir);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -19,16 +19,16 @@ impl Animation for TalkAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, _velocity, _global_time, look_dir): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let slowa = (anim_time as f32 * 6.0).sin();
let slowb = (anim_time as f32 * 4.0 + PI / 2.0).sin();
let slowc = (anim_time as f32 * 12.0 + PI / 2.0).sin();
let slowa = (anim_time * 6.0).sin();
let slowb = (anim_time * 4.0 + PI / 2.0).sin();
let slowc = (anim_time * 12.0 + PI / 2.0).sin();
next.head.orientation = Quaternion::rotation_x(slowc * 0.035 + look_dir.z * 0.7);
next.hand_l.position = Vec3::new(

View File

@ -14,7 +14,7 @@ type WieldAnimationDependency = (
Vec3<f32>,
Dir,
Vec3<f32>,
f64,
f32,
);
impl Animation for WieldAnimation {
type Dependency = WieldAnimationDependency;
@ -36,48 +36,38 @@ impl Animation for WieldAnimation {
velocity,
global_time,
): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let lab = 1.0;
let lab: f32 = 1.0;
let speed = Vec2::<f32>::from(velocity).magnitude();
let mut next = (*skeleton).clone();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 3.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 3.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
(global_time + anim_time / 3.0).floor().mul(7331.0).sin() * 0.2,
(global_time + anim_time / 3.0).floor().mul(1337.0).sin() * 0.1,
);
let foothoril = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.45).sin();
let foothoril = (anim_time * 16.0 * lab + PI * 1.45).sin();
let beltstatic = (anim_time as f32 * 10.0 * lab as f32 + PI / 2.0).sin();
let footvertlstatic = (anim_time as f32 * 10.0 * lab as f32).sin();
let footvertrstatic = (anim_time as f32 * 10.0 * lab as f32 + PI).sin();
let footrotl = (((1.0)
/ (0.5 + (0.5) * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin());
let beltstatic = (anim_time * 10.0 * lab + PI / 2.0).sin();
let footvertlstatic = (anim_time * 10.0 * lab).sin();
let footvertrstatic = (anim_time * 10.0 * lab + PI).sin();
let footrotl =
((1.0 / (0.5 + (0.5) * ((anim_time * 16.0 * lab + PI * 1.4).sin()).powi(2))).sqrt())
* ((anim_time * 16.0 * lab + PI * 1.4).sin());
let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin();
let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin();
let slowalt = (anim_time as f32 * 6.0 + PI).cos();
let u_slow = (anim_time as f32 * 2.5 + PI).sin();
let slow = (anim_time as f32 * 5.0 + PI).sin();
let slowalt = (anim_time * 6.0 + PI).cos();
let u_slow = (anim_time * 2.5 + PI).sin();
let slow = (anim_time * 5.0 + PI).sin();
let u_slowalt = (anim_time as f32 * 3.0 + PI).cos();
let short =
(((5.0) / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powi(2))).sqrt())
* ((anim_time as f32 * lab as f32 * 16.0).sin());
let u_slowalt = (anim_time * 3.0 + PI).cos();
let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 16.0).sin()).powi(2))).sqrt())
* ((anim_time * lab * 16.0).sin());
let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x;
let side = velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x;
let strafe = -((1.0 / (direction).abs() - 1.0).min(1.0)).copysign(side);

View File

@ -7,7 +7,7 @@ use std::f32::consts::PI;
pub struct FlyAnimation;
impl Animation for FlyAnimation {
type Dependency = (f32, f64);
type Dependency = (f32, f32);
type Skeleton = DragonSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,26 +17,26 @@ impl Animation for FlyAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 12.0;
let lab: f32 = 12.0;
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_ultra_slow = (anim_time * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time * 3.0 + PI).cos();
let wave_slow = (anim_time * 3.5 + PI).sin();
let wingl = (anim_time as f32 * 2.0 + PI).sin();
let wingr = (anim_time as f32 * 2.0).sin();
let wingl = (anim_time * 2.0 + PI).sin();
let wingr = (anim_time * 2.0).sin();
let footl = (anim_time as f32 * lab as f32 + PI).sin();
let footr = (anim_time as f32 * lab as f32).sin();
let footl = (anim_time * lab + PI).sin();
let footr = (anim_time * lab).sin();
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
let center = (anim_time * lab + PI / 2.0).sin();
let centeroffset = (anim_time * lab + PI * 1.5).sin();
next.head_upper.scale = Vec3::one() * 1.05;
next.head_lower.scale = Vec3::one() * 1.05;

View File

@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = DragonSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,27 +17,19 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let ultra_slow = (anim_time as f32 * 1.0).sin();
let slow = (anim_time as f32 * 2.5).sin();
let slowalt = (anim_time as f32 * 2.5 + PI / 2.0).sin();
let ultra_slow = (anim_time * 1.0).sin();
let slow = (anim_time * 2.5).sin();
let slowalt = (anim_time * 2.5 + PI / 2.0).sin();
let dragon_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25,
);
next.head_upper.scale = Vec3::one() * 1.05;

View File

@ -7,7 +7,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 = (f32, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>);
type Skeleton = DragonSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,22 +17,21 @@ impl Animation for RunAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, orientation, last_ori, _global_time, avg_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 0.6; //6
let lab: f32 = 0.6; //6
let short = (((1.0)
/ (0.72 + 0.28 * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.0).sin()).powi(2)))
let short = ((1.0 / (0.72 + 0.28 * ((anim_time * 16.0 * lab + PI * 1.0).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.0).sin());
* ((anim_time * 16.0 * lab + PI * 1.0).sin());
//
let shortalt = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.5).sin();
let shortalt = (anim_time * 16.0 * lab + PI * 0.5).sin();
//
let ori: Vec2<f32> = Vec2::from(orientation);
@ -50,23 +49,23 @@ impl Animation for RunAnimation {
} * 1.3;
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
let lab = 14;
let lab: f32 = 14.0;
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_ultra_slow_cos = (anim_time * 3.0 + PI).cos();
let wave_slow = (anim_time * 4.5).sin();
let vertlf = (anim_time as f32 * lab as f32 + PI * 1.8).sin().max(0.15);
let vertrfoffset = (anim_time as f32 * lab as f32 + PI * 0.80).sin().max(0.15);
let vertlboffset = (anim_time as f32 * lab as f32).sin().max(0.15);
let vertrb = (anim_time as f32 * lab as f32 + PI).sin().max(0.15);
let vertlf = (anim_time * lab + PI * 1.8).sin().max(0.15);
let vertrfoffset = (anim_time * lab + PI * 0.80).sin().max(0.15);
let vertlboffset = (anim_time * lab).sin().max(0.15);
let vertrb = (anim_time * lab + PI).sin().max(0.15);
let horilf = (anim_time as f32 * lab as f32 + PI * 1.2).sin();
let horirfoffset = (anim_time as f32 * lab as f32 + PI * 0.20).sin();
let horilboffset = (anim_time as f32 * lab as f32 + PI * 1.4).sin();
let horirb = (anim_time as f32 * lab as f32 + PI * 0.4).sin();
let horilf = (anim_time * lab + PI * 1.2).sin();
let horirfoffset = (anim_time * lab + PI * 0.20).sin();
let horilboffset = (anim_time * lab + PI * 1.4).sin();
let horirb = (anim_time * lab + PI * 0.4).sin();
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
let center = (anim_time * lab + PI / 2.0).sin();
let centeroffset = (anim_time * lab + PI * 1.5).sin();
next.head_lower.scale = Vec3::one() * 1.02;
next.jaw.scale = Vec3::one() * 1.05;

View File

@ -6,7 +6,7 @@ use std::f32::consts::PI;
pub struct IdleAnimation;
type IdleAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
type IdleAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>);
impl Animation for IdleAnimation {
type Dependency = IdleAnimationDependency;
@ -20,14 +20,14 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 3.5 + PI).sin();
let slowalt = (anim_time as f32 * 3.5 + PI + 0.2).sin();
let slow = (anim_time * 3.5 + PI).sin();
let slowalt = (anim_time * 3.5 + PI + 0.2).sin();
next.chest_front.scale = Vec3::one() / 11.0;

View File

@ -6,7 +6,7 @@ use std::f32::consts::PI;
pub struct SwimAnimation;
type SwimAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>, f32);
type SwimAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>, f32);
impl Animation for SwimAnimation {
type Dependency = SwimAnimationDependency;
@ -20,13 +20,13 @@ impl Animation for SwimAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slowalt = (acc_vel as f32 * s_a.tempo / 1.5 + PI + 0.2).sin();
let slowalt = (acc_vel * s_a.tempo / 1.5 + PI + 0.2).sin();
let fast = (acc_vel * s_a.tempo + PI).sin();
let fastalt = (acc_vel * s_a.tempo + PI + 0.2).sin();

View File

@ -6,7 +6,7 @@ use std::f32::consts::PI;
pub struct IdleAnimation;
type IdleAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
type IdleAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>);
impl Animation for IdleAnimation {
type Dependency = IdleAnimationDependency;
@ -20,13 +20,13 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 3.5 + PI).sin();
let slow = (anim_time * 3.5 + PI).sin();
next.chest.scale = Vec3::one() / 13.0;

View File

@ -6,7 +6,7 @@ use std::f32::consts::PI;
pub struct SwimAnimation;
type SwimAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>, f32);
type SwimAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>, f32);
impl Animation for SwimAnimation {
type Dependency = SwimAnimationDependency;
@ -20,7 +20,7 @@ impl Animation for SwimAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -7,7 +7,7 @@ use common::states::utils::StageSection;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (Option<StageSection>, f64, f64);
type Dependency = (Option<StageSection>, f32, f32);
type Skeleton = GolemSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,23 +18,23 @@ impl Animation for AlphaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(stage_section, global_time, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
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).powf(4.0)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let mirror = (check - 0.5).signum();
let move1 = move1base * pullback;
let move2 = move2base * pullback;

View File

@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = GolemSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,26 +18,18 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 1.0;
let breathe = (anim_time as f32 * lab as f32 + 1.5 * PI).sin();
let lab: f32 = 1.0;
let breathe = (anim_time * lab + 1.5 * PI).sin();
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25,
);
next.head.scale = Vec3::one() * 1.02;
next.jaw.scale = Vec3::one() * 1.02;

View File

@ -7,7 +7,7 @@ use std::f32::consts::PI;
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, f32);
type Dependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32, f32);
type Skeleton = GolemSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,42 +18,38 @@ impl Animation for RunAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, _global_time, acc_vel): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab = 0.45 * s_a.tempo;
let lab: f32 = 0.45 * s_a.tempo;
let speednorm = (speed / 7.0).powf(0.6);
let foothoril = (((1.0)
/ (0.4 + (0.6) * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()).powi(2)))
let foothoril = ((1.0 / (0.4 + (0.6) * ((acc_vel * 2.0 * lab + PI * 1.4).sin()).powi(2)))
.sqrt())
* ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin())
* ((acc_vel * 2.0 * lab + PI * 1.4).sin())
* speednorm;
let foothorir = (((1.0)
/ (0.4 + (0.6) * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()).powi(2)))
let foothorir = ((1.0 / (0.4 + (0.6) * ((acc_vel * 2.0 * lab + PI * 0.4).sin()).powi(2)))
.sqrt())
* ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin())
* ((acc_vel * 2.0 * lab + PI * 0.4).sin())
* speednorm;
let footvertl = (acc_vel * 2.0 * lab as f32).sin() * speednorm;
let footvertr = (acc_vel * 2.0 * lab as f32 + PI).sin() * speednorm;
let footvertl = (acc_vel * 2.0 * lab).sin() * speednorm;
let footvertr = (acc_vel * 2.0 * lab + PI).sin() * speednorm;
let footrotl = (((1.0)
/ (0.5 + (0.5) * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()).powi(2)))
let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * 2.0 * lab + PI * 1.4).sin()).powi(2)))
.sqrt())
* ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin())
* ((acc_vel * 2.0 * lab + PI * 1.4).sin())
* speednorm;
let footrotr = (((1.0)
/ (0.2 + (0.8) * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()).powi(2)))
let footrotr = ((1.0 / (0.2 + (0.8) * ((acc_vel * 2.0 * lab + PI * 0.4).sin()).powi(2)))
.sqrt())
* ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin())
* ((acc_vel * 2.0 * lab + PI * 0.4).sin())
* speednorm;
let short = (acc_vel * lab as f32 * 2.0).sin() * speednorm;
let shortalt = (acc_vel * lab as f32 * 2.0 + PI / 2.0).sin() * speednorm;
let short = (acc_vel * lab * 2.0).sin() * speednorm;
let shortalt = (acc_vel * lab * 2.0 + PI / 2.0).sin() * speednorm;
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
let tilt = if ::vek::Vec2::new(ori, last_ori)

View File

@ -8,7 +8,7 @@ use std::f32::consts::PI;
pub struct ShockwaveAnimation;
impl Animation for ShockwaveAnimation {
type Dependency = (Option<StageSection>, f32, f64);
type Dependency = (Option<StageSection>, f32, f32);
type Skeleton = GolemSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -19,16 +19,16 @@ impl Animation for ShockwaveAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(stage_section, velocity, _global_time): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (move1base, move2base, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(2.0)),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(2.0)),
_ => (0.0, 0.0, 0.0),
};

View File

@ -19,16 +19,16 @@ impl Animation for SpinMeleeAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
stage_section: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3) = 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).powf(4.0)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
_ => (0.0, 0.0, 0.0),
};

View File

@ -136,7 +136,7 @@ pub trait Animation {
fn update_skeleton_inner(
_skeleton: &Self::Skeleton,
_dependency: Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
_skeleton_attr: &<<Self as Animation>::Skeleton as Skeleton>::Attr,
) -> Self::Skeleton;
@ -146,7 +146,7 @@ pub trait Animation {
fn update_skeleton(
skeleton: &Self::Skeleton,
dependency: Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
skeleton_attr: &<<Self as Animation>::Skeleton as Skeleton>::Attr,
) -> Self::Skeleton {
@ -163,7 +163,7 @@ pub trait Animation {
fn(
&Self::Skeleton,
Self::Dependency,
f64,
f32,
&mut f32,
&<Self::Skeleton as Skeleton>::Attr,
) -> Self::Skeleton,

View File

@ -26,7 +26,7 @@ impl Animation for BeamAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, _stage_section, _body): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -7,7 +7,7 @@ use common::comp::item::ToolKind;
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f64);
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32);
type Skeleton = ObjectSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,7 +18,7 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, _global_time): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -26,7 +26,7 @@ impl Animation for ShootAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_active_tool_kind, _second_tool_kind, stage_section, body): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -35,9 +35,9 @@ impl Animation for ShootAnimation {
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};

View File

@ -8,7 +8,7 @@ use common::states::utils::StageSection;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,22 +18,22 @@ impl Animation for AlphaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_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).sqrt(), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (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 mirror = (check - 0.5).signum();
let twitch3 = (mirror * movement3 * 9.0).sin();
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;

View File

@ -8,7 +8,7 @@ use common::states::utils::StageSection;
pub struct BetaAnimation;
impl Animation for BetaAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,22 +18,22 @@ impl Animation for BetaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_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).sqrt(), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (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 mirror = (check - 0.5).signum();
let twitch3 = (mirror * movement3 * 9.0).sin();
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;

View File

@ -9,7 +9,7 @@ use std::f32::consts::PI;
pub struct BreatheAnimation;
impl Animation for BreatheAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -19,7 +19,7 @@ impl Animation for BreatheAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -27,15 +27,15 @@ impl Animation for BreatheAnimation {
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1base, _movement2base, movement3, twitch) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0, 0.0),
Some(StageSection::Cast) => (1.0, (anim_time as f32).min(1.0), 0.0, anim_time as f32),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32, 1.0),
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0),
Some(StageSection::Cast) => (1.0, anim_time.min(1.0), 0.0, anim_time),
Some(StageSection::Recover) => (1.0, 1.0, anim_time, 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 mirror = (check - 0.5).signum();
let twitch2 = mirror * (twitch * 20.0).sin() * pullback;
let twitch2alt = mirror * (twitch * 20.0 + PI / 2.0).sin() * pullback;

View File

@ -9,7 +9,7 @@ use std::f32::consts::PI;
pub struct DashAnimation;
impl Animation for DashAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -19,23 +19,23 @@ impl Animation for DashAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_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).sqrt(), 0.0, 0.0, 0.0),
Some(StageSection::Buildup) => (anim_time.sqrt(), 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).powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
_ => (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 mirror = (check - 0.5).signum();
let twitch1 = (mirror * movement1base * 9.5).sin();
let twitch1fast = (mirror * movement1base * 25.0).sin();
//let twitch3 = (mirror * movement3 * 4.0).sin();
@ -43,14 +43,12 @@ impl Animation for DashAnimation {
//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_f32 + PI * 0.25).sin()).powi(2)))
let short = ((1.0 / (0.72 + 0.28 * ((anim_time * 16.0_f32 + PI * 0.25).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 16.0_f32 + PI * 0.25).sin())
* ((anim_time * 16.0_f32 + PI * 0.25).sin())
* chargemovementbase
* pullback;
let shortalt =
(anim_time as f32 * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback;
let shortalt = (anim_time * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback;
next.head_upper.orientation =
Quaternion::rotation_x(movement1abs * 0.4 + movement2abs * 0.3)

View File

@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,27 +17,19 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slower = (anim_time as f32 * 1.25).sin();
let slow = (anim_time as f32 * 2.5).sin();
let slowalt = (anim_time as f32 * 2.5 + PI / 2.0).sin();
let slower = (anim_time * 1.25).sin();
let slow = (anim_time * 2.5).sin();
let slowalt = (anim_time * 2.5 + PI / 2.0).sin();
let dragon_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
(global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.2,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.1,
);
next.jaw.scale = Vec3::one() * 0.98;
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;

View File

@ -6,7 +6,7 @@ use super::{
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = (f32, f64);
type Dependency = (f32, f32);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,7 +16,7 @@ impl Animation for JumpAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -7,7 +7,7 @@ use std::f32::consts::PI;
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency = (f32, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>, f32);
type Dependency = (f32, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>, f32);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,7 +17,7 @@ impl Animation for RunAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -26,39 +26,38 @@ impl Animation for RunAnimation {
let speednorm = (speed / 15.0).powf(0.25);
let lab = 0.8 * s_a.tempo;
let lab: f32 = 0.8 * s_a.tempo;
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()).max(-0.7) * speednorm;
let short = (((1.0) / (0.72 + 0.28 * ((acc_vel * lab as f32 + PI * 0.25).sin()).powi(2)))
let short = ((1.0 / (0.72 + 0.28 * ((acc_vel * lab + PI * 0.25).sin()).powi(2))).sqrt())
* ((acc_vel * lab + PI * 0.25).sin())
* speednorm;
let shortalt = (acc_vel * lab + PI * 0.25).sin();
let foothoril = ((1.0 / (0.4 + (0.6) * ((acc_vel * lab + PI * 1.45).sin()).powi(2)))
.sqrt())
* ((acc_vel * lab as f32 + PI * 0.25).sin())
* ((acc_vel * lab + PI * 1.45).sin())
* speednorm;
let shortalt = (acc_vel * lab as f32 + PI * 0.25).sin();
let footvertl = (acc_vel * lab + PI * 0.0).sin() * speednorm;
let foothoril =
(((1.0) / (0.4 + (0.6) * ((acc_vel * lab as f32 + PI * 1.45).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 1.45).sin())
let foothorir = ((1.0 / (0.4 + (0.6) * ((acc_vel * lab + PI * 0.45).sin()).powi(2)))
.sqrt())
* ((acc_vel * lab + PI * 0.45).sin())
* speednorm;
let footvertl = (acc_vel * lab as f32 + PI * 0.0).sin() * speednorm;
let foothorir =
(((1.0) / (0.4 + (0.6) * ((acc_vel * lab as f32 + PI * 0.45).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 0.45).sin())
* speednorm;
let footvertr = (acc_vel * lab as f32 + PI).sin() * speednorm;
let footvertr = (acc_vel * lab + PI).sin() * speednorm;
//back feet
let foothorilb =
(((1.0) / (0.4 + (0.6) * ((acc_vel * lab as f32 + PI * 1.05).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 1.05).sin())
let foothorilb = ((1.0 / (0.4 + (0.6) * ((acc_vel * lab + PI * 1.05).sin()).powi(2)))
.sqrt())
* ((acc_vel * lab + PI * 1.05).sin())
* speednorm;
let footvertlb = (acc_vel * lab as f32 + PI * (-0.4)).sin() * speednorm;
let footvertlb = (acc_vel * lab + PI * (-0.4)).sin() * speednorm;
let foothorirb =
(((1.0) / (0.4 + (0.6) * ((acc_vel * lab as f32 + PI * 0.05).sin()).powi(2))).sqrt())
* ((acc_vel * lab as f32 + PI * 0.05).sin())
let foothorirb = ((1.0 / (0.4 + (0.6) * ((acc_vel * lab + PI * 0.05).sin()).powi(2)))
.sqrt())
* ((acc_vel * lab + PI * 0.05).sin())
* speednorm;
let footvertrb = (acc_vel * lab as f32 + PI * 0.6).sin() * speednorm;
let footvertrb = (acc_vel * lab + PI * 0.6).sin() * speednorm;
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);

View File

@ -7,7 +7,7 @@ use common::states::utils::StageSection;
pub struct ShootAnimation;
impl Animation for ShootAnimation {
type Dependency = (f32, f64, Option<StageSection>);
type Dependency = (f32, f32, Option<StageSection>);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,16 +17,16 @@ impl Animation for ShootAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};

View File

@ -8,7 +8,7 @@ use common::states::utils::StageSection;
pub struct StunnedAnimation;
impl Animation for StunnedAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,25 +18,23 @@ impl Animation for StunnedAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2, twitch) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Recover) => (
1.0,
(anim_time as f32).powf(3.0),
((1.0 - anim_time as f32) * 7.0).sin(),
),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Recover) => {
(1.0, anim_time.powf(3.0), ((1.0 - anim_time) * 7.0).sin())
},
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement2;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let mirror = (check - 0.5).signum();
let movement1 = mirror * movement1base * pullback;
let movement1abs = movement1base * pullback;

View File

@ -7,7 +7,7 @@ use common::states::utils::StageSection;
pub struct TailwhipAnimation;
impl Animation for TailwhipAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,34 +17,26 @@ impl Animation for TailwhipAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2base, movement3, twitch1, twitch2) = match stage_section {
Some(StageSection::Charge) => (
(anim_time as f32).min(1.2),
0.0,
0.0,
(anim_time as f32 * 15.0).sin(),
0.0,
),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0, 1.0, 0.0),
Some(StageSection::Recover) => (
1.0,
1.0,
(anim_time as f32).powi(6),
1.0,
(anim_time as f32 * 7.0).sin(),
),
Some(StageSection::Charge) => {
(anim_time.min(1.2), 0.0, 0.0, (anim_time * 15.0).sin(), 0.0)
},
Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0, 1.0, 0.0),
Some(StageSection::Recover) => {
(1.0, 1.0, anim_time.powi(6), 1.0, (anim_time * 7.0).sin())
},
_ => (0.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 mirror = (check - 0.5).signum();
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;

View File

@ -7,7 +7,7 @@ use common::states::utils::StageSection;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,7 +17,7 @@ impl Animation for AlphaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -25,15 +25,15 @@ impl Animation for AlphaAnimation {
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(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (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 mirror = (check - 0.5).signum();
let movement1 = movement1base * mirror * pullback;
let movement1abs = movement1base * pullback;
let movement2 = movement2base * mirror * pullback;

View File

@ -7,7 +7,7 @@ use common::states::utils::StageSection;
pub struct BetaAnimation;
impl Animation for BetaAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,7 +17,7 @@ impl Animation for BetaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -25,15 +25,15 @@ impl Animation for BetaAnimation {
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(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).sqrt(), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.sqrt(), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (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 mirror = (check - 0.5).signum();
let movement1 = movement1base * mirror * pullback;
let movement1abs = movement1base * pullback;
let movement2 = movement2base * mirror * pullback;

View File

@ -9,7 +9,7 @@ use std::f32::consts::PI;
pub struct DashAnimation;
impl Animation for DashAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -19,7 +19,7 @@ impl Animation for DashAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -27,18 +27,16 @@ impl Animation for DashAnimation {
let (movement1base, chargemovementbase, movement2base, movement3, legtell) =
match stage_section {
Some(StageSection::Buildup) => {
((anim_time as f32).sqrt(), 0.0, 0.0, 0.0, (anim_time as f32))
},
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0, anim_time),
Some(StageSection::Charge) => (1.0, 1.0, 0.0, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powi(4), 0.0, 1.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32, 1.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powi(4), 0.0, 1.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time, 1.0),
_ => (0.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 mirror = (check - 0.5).signum();
let twitch1 = (mirror * movement1base * 9.5).sin();
let twitch1fast = (mirror * movement1base * 25.0).sin();
//let twitch3 = (mirror * movement3 * 4.0).sin();
@ -48,14 +46,12 @@ impl Animation for DashAnimation {
let movement2abs = movement2base * pullback;
let legtwitch = (legtell * 6.0).sin() * pullback;
let legswing = legtell * pullback;
let short = (((1.0)
/ (0.72 + 0.28 * ((anim_time as f32 * 16.0_f32 + PI * 0.25).sin()).powi(2)))
let short = ((1.0 / (0.72 + 0.28 * ((anim_time * 16.0_f32 + PI * 0.25).sin()).powi(2)))
.sqrt())
* ((anim_time as f32 * 16.0_f32 + PI * 0.25).sin())
* ((anim_time * 16.0_f32 + PI * 0.25).sin())
* chargemovementbase
* pullback;
let shortalt =
(anim_time as f32 * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback;
let shortalt = (anim_time * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback;
next.head.orientation = Quaternion::rotation_x(movement1abs * -0.2 + movement2abs * 0.8)
* Quaternion::rotation_z(short * -0.06 + twitch1 * 0.2);

View File

@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct FeedAnimation;
impl Animation for FeedAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,29 +17,21 @@ impl Animation for FeedAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
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 slower = (anim_time * 1.0 + PI).sin();
let slow = (anim_time * 3.5 + PI).sin();
let fast = (anim_time * 5.0).sin();
let faster = (anim_time * 14.0).sin();
let transition = (((anim_time as f32).powf(2.0)).min(1.0)) * s_a.feed.1;
let transition = ((anim_time.powf(2.0)).min(1.0)) * s_a.feed.1;
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25,
);
if s_a.feed.0 {
@ -69,8 +61,7 @@ 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 * (anim_time as f32).min(1.0) - 0.08);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05 * anim_time.min(1.0) - 0.08);
}
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);

View File

@ -8,7 +8,7 @@ use std::f32::consts::PI;
pub struct HoofAnimation;
impl Animation for HoofAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,7 +18,7 @@ impl Animation for HoofAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -26,22 +26,20 @@ impl Animation for HoofAnimation {
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1base, movement2base, movement3, twitch) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Swing) => {
(1.0, (anim_time as f32).powf(0.25), 0.0, anim_time as f32)
},
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4), 1.0),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0, anim_time),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 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 mirror = (check - 0.5).signum();
let movement1 = movement1base * mirror * pullback;
let movement2 = movement2base * mirror * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
let twitchleft = (twitch as f32 * 16.0).sin() * pullback * mirror;
let twitchleft = (twitch * 16.0).sin() * pullback * mirror;
let twitchright = (twitch * 8.0 + PI / 2.0).sin() * pullback * mirror;
next.head.orientation = Quaternion::rotation_x(movement1abs * -0.6 + movement2abs * 0.6)

View File

@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,38 +17,22 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
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 slower = (anim_time * 1.0 + PI).sin();
let slow = (anim_time * 3.5 + PI).sin();
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25,
);
let tailmove = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.25,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.125,
(global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.25,
(global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.125,
);
next.neck.scale = Vec3::one() * 1.02;

View File

@ -6,7 +6,7 @@ use super::{
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,7 +16,7 @@ impl Animation for JumpAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -7,7 +7,7 @@ use common::states::utils::StageSection;
pub struct LeapMeleeAnimation;
impl Animation for LeapMeleeAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,7 +17,7 @@ impl Animation for LeapMeleeAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
@ -25,16 +25,16 @@ impl Animation for LeapMeleeAnimation {
//let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1base, movement2base, movement3base, movement4) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (0.0, 1.0, 1.0, (anim_time as f32).powi(4)),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time, 0.0),
Some(StageSection::Recover) => (0.0, 1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement4;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let mirror = (check - 0.5).signum();
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
let movement3abs = movement3base * pullback;

View File

@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency = (f32, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>, f32);
type Dependency = (f32, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>, f32);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,41 +17,31 @@ impl Animation for RunAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, global_time, avg_vel, acc_vel): Self::Dependency,
anim_time: f64,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
*rate = 1.0;
let lab = 0.72;
let lab: f32 = 0.72;
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.6);
let short = (((1.0)
let short = ((1.0
/ (0.72
+ 0.28
* ((acc_vel * (1.0) * lab as f32 * speedmult + PI * -0.15 - 0.5).sin())
.powi(2)))
+ 0.28 * ((acc_vel * (1.0) * lab * speedmult + PI * -0.15 - 0.5).sin()).powi(2)))
.sqrt())
* ((acc_vel * (1.0) * lab as f32 * speedmult + PI * -0.15 - 0.5).sin());
* ((acc_vel * (1.0) * lab * speedmult + PI * -0.15 - 0.5).sin());
//
let shortalt = (acc_vel * (1.0) * lab as f32 * speedmult + PI * 3.0 / 8.0 - 0.5).sin();
let shortalt = (acc_vel * (1.0) * lab * speedmult + PI * 3.0 / 8.0 - 0.5).sin();
let look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.25,
);
let speedadjust = if speed < 5.0 { 0.0 } else { speed / 24.0 };
@ -61,21 +51,17 @@ impl Animation for RunAnimation {
let shift4 = speedadjust - PI * 3.0 / 4.0 + speedadjust * PI / 2.0;
//FL
let foot1a =
(acc_vel * (1.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift1).sin(); //1.5
let foot1b =
(acc_vel * (1.0) * lab as f32 * speedmult + 1.1 + canceler * 0.05 + shift1).sin(); //1.9
let foot1a = (acc_vel * (1.0) * lab * speedmult + 0.0 + canceler * 0.05 + shift1).sin(); //1.5
let foot1b = (acc_vel * (1.0) * lab * speedmult + 1.1 + canceler * 0.05 + shift1).sin(); //1.9
//FR
let foot2a = (acc_vel * (1.0) * lab as f32 * speedmult + shift2).sin(); //1.0
let foot2b = (acc_vel * (1.0) * lab as f32 * speedmult + 1.1 + shift2).sin(); //1.0
let foot2a = (acc_vel * (1.0) * lab * speedmult + shift2).sin(); //1.0
let foot2b = (acc_vel * (1.0) * lab * speedmult + 1.1 + shift2).sin(); //1.0
//BL
let foot3a = (acc_vel * (1.0) * lab as f32 * speedmult + shift3).sin(); //0.0
let foot3b = (acc_vel * (1.0) * lab as f32 * speedmult + 1.57 + shift3).sin(); //0.4
let foot3a = (acc_vel * (1.0) * lab * speedmult + shift3).sin(); //0.0
let foot3b = (acc_vel * (1.0) * lab * speedmult + 1.57 + shift3).sin(); //0.4
//BR
let foot4a =
(acc_vel * (1.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift4).sin(); //0.3
let foot4b =
(acc_vel * (1.0) * lab as f32 * speedmult + 1.57 + canceler * 0.05 + shift4).sin(); //0.7
let foot4a = (acc_vel * (1.0) * lab * speedmult + 0.0 + canceler * 0.05 + shift4).sin(); //0.3
let foot4b = (acc_vel * (1.0) * lab * speedmult + 1.57 + canceler * 0.05 + shift4).sin(); //0.7
//
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);

View File

@ -7,7 +7,7 @@ use common::states::utils::StageSection;
pub struct StunnedAnimation;
impl Animation for StunnedAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,25 +17,23 @@ impl Animation for StunnedAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2, twitch) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Recover) => (
1.0,
(anim_time as f32).powf(3.0),
((1.0 - anim_time as f32) * 7.0).sin(),
),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Recover) => {
(1.0, anim_time.powf(3.0), ((1.0 - anim_time) * 7.0).sin())
},
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement2;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let mirror = (check - 0.5).signum();
let movement1 = movement1base * mirror * pullback;
let movement1abs = movement1base * pullback;

View File

@ -8,7 +8,7 @@ use common::states::utils::StageSection;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,22 +18,22 @@ impl Animation for AlphaAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_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).sqrt(), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (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 mirror = (check - 0.5).signum();
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;

View File

@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct FeedAnimation;
impl Animation for FeedAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = QuadrupedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,28 +17,20 @@ impl Animation for FeedAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 5.0).sin();
let quick = (anim_time as f32 * 14.0).sin();
let slow = (anim_time * 5.0).sin();
let quick = (anim_time * 14.0).sin();
let slow_alt = (anim_time as f32 * 3.5 + PI).sin();
let slow_alt = (anim_time * 3.5 + PI).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 1.0,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.5,
(global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 1.0,
(global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.5,
);
next.chest.scale = Vec3::one() / 11.0 * s_a.scaler;

View File

@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul};
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = f64;
type Dependency = f32;
type Skeleton = QuadrupedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,27 +17,19 @@ impl Animation for IdleAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 3.5).sin();
let slow = (anim_time * 3.5).sin();
let slow_alt = (anim_time as f32 * 3.5 + PI / 2.0).sin();
let slow_alt = (anim_time * 3.5 + PI / 2.0).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
(global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5,
(global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * 0.2);

View File

@ -6,7 +6,7 @@ use super::{
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = (f32, f64);
type Dependency = (f32, f32);
type Skeleton = QuadrupedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,7 +16,7 @@ impl Animation for JumpAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, _global_time): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {

View File

@ -7,7 +7,7 @@ use std::f32::consts::PI;
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency = (f32, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>, f32);
type Dependency = (f32, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>, f32);
type Skeleton = QuadrupedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,25 +17,25 @@ impl Animation for RunAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency,
_anim_time: f64,
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 0.8; //6
let lab: f32 = 0.8; //6
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(12.0);
let speednorm = (speed / 12.0).powf(0.4);
let speedmult = s_a.tempo;
let short = (acc_vel * lab as f32 * speedmult + PI * 1.0).sin() * speednorm;
let shortalt = (acc_vel * lab as f32 * speedmult + PI * 0.5).sin() * speednorm;
let short = (acc_vel * lab * speedmult + PI * 1.0).sin() * speednorm;
let shortalt = (acc_vel * lab * speedmult + PI * 0.5).sin() * speednorm;
let footvert = (acc_vel * lab as f32 * speedmult + PI * 0.0).sin() * speednorm;
let footvertt = (acc_vel * lab as f32 * speedmult + PI * 0.4).sin() * speednorm;
let footvert = (acc_vel * lab * speedmult + PI * 0.0).sin() * speednorm;
let footvertt = (acc_vel * lab * speedmult + PI * 0.4).sin() * speednorm;
let footvertf = (acc_vel * lab as f32 * speedmult + PI * 0.3).sin() * speednorm;
let footverttf = (acc_vel * lab as f32 * speedmult + PI * 0.7).sin() * speednorm;
let footvertf = (acc_vel * lab * speedmult + PI * 0.3).sin() * speednorm;
let footverttf = (acc_vel * lab * speedmult + PI * 0.7).sin() * speednorm;
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);

View File

@ -8,7 +8,7 @@ use common::states::utils::StageSection;
pub struct StunnedAnimation;
impl Animation for StunnedAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Dependency = (f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -18,25 +18,23 @@ impl Animation for StunnedAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2, twitch) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Recover) => (
1.0,
(anim_time as f32).powf(3.0),
((1.0 - anim_time as f32) * 10.0).sin(),
),
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Recover) => {
(1.0, anim_time.powf(3.0), ((1.0 - anim_time) * 10.0).sin())
},
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement2;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let mirror = (check - 0.5).signum();
let movement1 = mirror * movement1base * pullback;
let movement1abs = movement1base * pullback;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);

Some files were not shown because too many files have changed in this diff Show More