Merge branch 'combat' of https://gitlab.com/veloren/veloren into combat

This commit is contained in:
AdamWhitehurst 2020-03-29 13:40:08 -07:00
commit d3b99fc026
12 changed files with 165 additions and 200 deletions

View File

@ -68,7 +68,7 @@ bincode = "1.2"
deunicode = "1.0"
uvth = "3.1.1"
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "65571ade0d954a0e0bd995fdb314854ff146ab97" }
const-tweaker = { version = "0.2.4", optional = true }
const-tweaker = { version = "0.2.5", optional = true }
[target.'cfg(target_os = "macos")'.dependencies]
dispatch = "0.1.4"

View File

@ -32,11 +32,15 @@ impl Animation for AlphaAnimation {
let accel_slow = 1.0 - (anim_time as f32 * 12.0 * lab as f32).cos();
let accel_fast = 1.0 - (anim_time as f32 * 24.0 * lab as f32).cos();
let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin();
let push = anim_time as f32 * lab as f32 * 4.0;
let slow = (((5.0)
/ (0.6 + 4.4 * ((anim_time as f32 * lab as f32 * 11.0).sin()).powf(2.0 as f32)))
/ (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 9.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 11.0).sin());
* ((anim_time as f32 * lab as f32 * 9.0).sin());
let quick = (((5.0)
/ (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 18.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 18.0).sin());
let slower = (((5.0)
/ (0.1 + 4.9 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32)))
.sqrt())
@ -54,50 +58,51 @@ impl Animation for AlphaAnimation {
-2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 14.0,
);
next.head.ori = Quaternion::rotation_z(slow * 0.08)
* Quaternion::rotation_x(0.0 + slow * 0.08)
* Quaternion::rotation_y(slow * -0.08);
next.head.ori = Quaternion::rotation_z(slow * -0.25)
* Quaternion::rotation_x(0.0 + slow * 0.15)
* Quaternion::rotation_y(slow * -0.15);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
next.chest.ori = Quaternion::rotation_z(slow * -0.2)
next.chest.ori = Quaternion::rotation_z(slow * 0.4)
* Quaternion::rotation_x(0.0 + slow * -0.2)
* Quaternion::rotation_y(slow * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = next.chest.ori * -0.2;
next.belt.ori = next.chest.ori * -0.3;
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = next.chest.ori * -0.15;
next.shorts.ori = next.chest.ori * -0.45;
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
next.l_hand.offset = Vec3::new(-0.25, -5.0, 1.0);
next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
next.l_hand.scale = Vec3::one() * 1.05;
next.r_hand.offset = Vec3::new(1.25, -5.5, -2.0);
next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
next.main.offset = Vec3::new(0.0, 0.0, 0.0);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0 - slow * 1.0, 3.0 - slow * 5.0, 0.0);
next.control.ori = Quaternion::rotation_x(-1.4)
* Quaternion::rotation_y(slow * 1.5 + 0.7)
* Quaternion::rotation_z(1.4 + slow * 0.5);
next.control.offset = Vec3::new(-10.0 + push * 5.0, 6.0 + push * 5.0, 2.0);
next.control.ori = Quaternion::rotation_x(-1.4 + slow * 0.4)
* Quaternion::rotation_y(slow * -1.3)
* Quaternion::rotation_z(1.4 + slow * -0.5);
next.control.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, foot * 3.0 + slow * -5.0, 8.0);
next.l_foot.ori =
Quaternion::rotation_x(foot * -0.6) * Quaternion::rotation_y(foot * 0.2);
next.l_foot.offset = Vec3::new(-3.4, slow * -3.0 + quick * 3.0 - 4.0, 8.0);
next.l_foot.ori = Quaternion::rotation_x(slow * 0.6)
* Quaternion::rotation_y((slow * -0.2).max(0.0));
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, foot * -3.0 + slow * 5.0, 8.0);
next.r_foot.ori =
Quaternion::rotation_x(foot * 0.6) * Quaternion::rotation_y(foot * -0.2);
next.r_foot.offset = Vec3::new(3.4, slow * 3.0 + quick * -3.0 + 5.0, 8.0);
next.r_foot.ori = Quaternion::rotation_x(slow * -0.6)
* Quaternion::rotation_y((slow * 0.2).min(0.0));
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)

View File

@ -1,5 +1,6 @@
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
use common::comp::item::ToolKind;
use std::f32::consts::PI;
use vek::*;
pub struct ChargeAnimation;
@ -30,15 +31,21 @@ impl Animation for ChargeAnimation {
.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 * 10.0).cos()).powf(2.0 as f32)))
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 20.0).cos()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 20.0).cos());
let quick = (((5.0)
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 2.0).cos()).powf(2.0 as f32)))
/ (3.5 + 1.5 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 2.0).cos());
* ((anim_time as f32 * lab as f32 * 8.0).sin());
let quicka = (((5.0)
/ (3.5
+ 1.5
* ((anim_time as f32 * lab as f32 * 8.0 + PI / 2.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 8.0 + PI / 2.0).sin());
let stop = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
let stopa = ((anim_time as f32).powf(0.9 as f32)).min(5.0);
next.head.offset = Vec3::new(
0.0 + stop * -2.0 + skeleton_attr.neck_right,
@ -75,16 +82,20 @@ impl Animation for ChargeAnimation {
* Quaternion::rotation_y(0.5)
* Quaternion::rotation_z(-0.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(11.0, 9.0, 10.0);
next.main.offset = Vec3::new(9.2, 8.4, 13.2);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0 - quick * 5.0);
next.control.ori = Quaternion::rotation_x(quick * 1.3)
next.control.offset = Vec3::new(
-7.0 + quick * 3.5 * (1.0 / (stopa + 0.1)),
6.0 + quicka * 3.5 * (1.0 / (stopa + 0.1)),
6.0 - stop * 3.0,
);
next.control.ori = Quaternion::rotation_x(stop * -0.2)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(quick * 1.5);
* Quaternion::rotation_z(stop * 0.2);
next.control.scale = Vec3::one();
},
Some(ToolKind::Bow(_)) => {

View File

@ -1,5 +1,6 @@
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
use common::comp::item::ToolKind;
use std::f32::consts::PI;
use vek::*;
pub struct ClimbAnimation;
@ -21,66 +22,69 @@ impl Animation for ClimbAnimation {
*rate = speed;
let constant = 1.0;
let wave = (anim_time as f32 * constant as f32 * 1.5).sin();
let wave_cos = (anim_time as f32 * constant as f32 * 1.5).cos();
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 wave_test = (((5.0)
let quick = (((5.0)
/ (0.6 + 4.0 * ((anim_time as f32 * constant as f32 * 1.5).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * constant as f32 * 1.5).sin());
let wave_testc = (((5.0)
/ (0.6 + 4.0 * ((anim_time as f32 * constant as f32 * 1.5).cos()).powf(2.0 as f32)))
let quicka = (((5.0)
/ (0.6
+ 4.0
* ((anim_time as f32 * constant as f32 * 1.5 + PI / 2.0).sin())
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * constant as f32 * 1.5).cos());
* ((anim_time as f32 * constant as f32 * 1.5 + PI / 2.0).sin());
next.head.offset = Vec3::new(
0.0,
-4.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 13.50 + wave_cos * 0.2,
skeleton_attr.neck_height + 13.50 + smootha * 0.2,
);
next.head.ori = Quaternion::rotation_z(wave * 0.1)
next.head.ori = Quaternion::rotation_z(smooth * 0.1)
* Quaternion::rotation_x(0.6)
* Quaternion::rotation_y(wave_test * 0.1);
* Quaternion::rotation_y(quick * 0.1);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 1.0, 5.0 + wave_cos * 1.1);
next.chest.ori = Quaternion::rotation_z(wave_test * 0.25)
next.chest.offset = Vec3::new(0.0, 1.0, 5.0 + smootha * 1.1);
next.chest.ori = Quaternion::rotation_z(quick * 0.25)
* Quaternion::rotation_x(-0.15)
* Quaternion::rotation_y(wave_test * -0.12);
* Quaternion::rotation_y(quick * -0.12);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 1.0, -2.0);
next.belt.ori = Quaternion::rotation_z(wave_test * 0.0) * Quaternion::rotation_x(0.0);
next.belt.ori = Quaternion::rotation_z(quick * 0.0) * Quaternion::rotation_x(0.0);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 1.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(wave_test * 0.0)
next.shorts.ori = Quaternion::rotation_z(quick * 0.0)
* Quaternion::rotation_x(0.1)
* Quaternion::rotation_y(wave_test * 0.10);
* Quaternion::rotation_y(quick * 0.10);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-6.0, -0.25 + wave_testc * 1.5, 6.0 - wave_test * 4.0);
next.l_hand.ori = Quaternion::rotation_x(2.2 + wave_testc * 0.5);
next.l_hand.offset = Vec3::new(-6.0, -0.25 + quicka * 1.5, 6.0 - quick * 4.0);
next.l_hand.ori = Quaternion::rotation_x(2.2 + quicka * 0.5);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(6.0, -0.25 - wave_testc * 1.5, 6.0 + wave_test * 4.0);
next.r_hand.ori = Quaternion::rotation_x(2.2 - wave_testc * 0.5);
next.r_hand.offset = Vec3::new(6.0, -0.25 - quicka * 1.5, 6.0 + quick * 4.0);
next.r_hand.ori = Quaternion::rotation_x(2.2 - quicka * 0.5);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0 + wave_test * 2.5);
next.l_foot.ori = Quaternion::rotation_x(0.2 - wave_testc * 0.5);
next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0 + quick * 2.5);
next.l_foot.ori = Quaternion::rotation_x(0.2 - quicka * 0.5);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 1.0, 6.0 - wave_test * 2.5);
next.r_foot.ori = Quaternion::rotation_x(0.2 + wave_testc * 0.5);
next.r_foot.offset = Vec3::new(3.4, 1.0, 6.0 - quick * 2.5);
next.r_foot.ori = Quaternion::rotation_x(0.2 + quicka * 0.5);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15);
next.l_shoulder.ori = Quaternion::rotation_x(smootha * 0.15);
next.l_shoulder.scale = Vec3::one() * 1.1;
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7);
next.r_shoulder.ori = Quaternion::rotation_x(wave * 0.15);
next.r_shoulder.ori = Quaternion::rotation_x(smooth * 0.15);
next.r_shoulder.scale = Vec3::one() * 1.1;
next.glider.offset = Vec3::new(0.0, 5.0, 0.0);
@ -92,8 +96,7 @@ impl Animation for ClimbAnimation {
-5.0 + skeleton_attr.weapon_y,
18.0,
);
next.main.ori =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + smootha * 0.25);
next.main.scale = Vec3::one();
next.second.offset = Vec3::new(
@ -108,7 +111,7 @@ impl Animation for ClimbAnimation {
next.lantern.ori = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, -0.2 + wave * -0.08, 0.4) * skeleton_attr.scaler;
next.torso.offset = Vec3::new(0.0, -0.2 + smooth * -0.08, 0.4) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;

View File

@ -20,7 +20,6 @@ impl Animation for DashAnimation {
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let constant = 8.0;
let lab = 1.0;
let foot = (((5.0)
@ -33,11 +32,6 @@ impl Animation for DashAnimation {
.sqrt())
* ((anim_time as f32 * lab as f32 * 12.4).sin());
let wave_cos = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * constant as f32 * 1.5).sin());
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Sword(_)) => {
@ -51,7 +45,7 @@ impl Animation for DashAnimation {
* Quaternion::rotation_y(0.0);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 2.0);
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 2.0);
next.chest.ori = Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7);
next.chest.scale = Vec3::one();

View File

@ -20,12 +20,12 @@ impl Animation for GlidingAnimation {
let speed = Vec2::<f32>::from(velocity).magnitude();
let wave_slow = (anim_time as f32 * 7.0).sin();
let wave_slow_cos = (anim_time as f32 * 7.0).cos();
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 wave_very_slow = (anim_time as f32 * 3.0).sin();
let wave_very_slow_alt = (anim_time as f32 * 2.5).sin();
let wave_very_slow_cos = (anim_time as f32 * 3.0).cos();
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 head_look = Vec2::new(
((global_time + anim_time) as f32 / 4.0)
@ -60,48 +60,40 @@ impl Animation for GlidingAnimation {
-2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 12.0,
);
next.head.ori = Quaternion::rotation_x(0.35 - wave_very_slow * 0.10 + head_look.y)
* Quaternion::rotation_z(head_look.x + wave_very_slow_cos * 0.15);
next.head.ori = Quaternion::rotation_x(0.35 - slow * 0.10 + head_look.y)
* Quaternion::rotation_z(head_look.x + slowa * 0.15);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, -2.0);
next.chest.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.2);
next.chest.ori = Quaternion::rotation_z(slowa * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25);
next.belt.ori = Quaternion::rotation_z(slowa * 0.25);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.35);
next.shorts.ori = Quaternion::rotation_z(slowa * 0.35);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-9.5 + wave_very_slow_cos * -1.5,
-3.0 + wave_very_slow_cos * 1.5,
6.0,
);
next.l_hand.ori = Quaternion::rotation_x(-2.7 + wave_very_slow_cos * -0.1);
next.l_hand.offset = Vec3::new(-9.5 + slowa * -1.5, -3.0 + slowa * 1.5, 6.0);
next.l_hand.ori = Quaternion::rotation_x(-2.7 + slowa * -0.1);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(
9.5 + wave_very_slow_cos * -1.5,
-3.0 + wave_very_slow_cos * -1.5,
6.0,
);
next.r_hand.ori = Quaternion::rotation_x(-2.7 + wave_very_slow_cos * -0.10);
next.r_hand.offset = Vec3::new(9.5 + slowa * -1.5, -3.0 + slowa * -1.5, 6.0);
next.r_hand.ori = Quaternion::rotation_x(-2.7 + slowa * -0.10);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, 1.0, -2.0);
next.l_foot.ori = Quaternion::rotation_x(
(wave_stop * -0.7 - wave_slow_cos * -0.21 + wave_very_slow * 0.19) * speed * 0.04,
(wave_stop * -0.7 - quicka * -0.21 + slow * 0.19) * speed * 0.04,
);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 1.0, -2.0);
next.r_foot.ori = Quaternion::rotation_x(
(wave_stop * -0.8 + wave_slow * -0.25 + wave_very_slow_alt * 0.13) * speed * 0.04,
(wave_stop * -0.8 + quick * -0.25 + slowb * 0.13) * speed * 0.04,
);
next.r_foot.scale = Vec3::one();
@ -113,9 +105,8 @@ impl Animation for GlidingAnimation {
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
next.r_shoulder.scale = Vec3::one() * 1.1;
next.glider.offset = Vec3::new(0.0, -13.0 + wave_very_slow * 0.10, 6.0);
next.glider.ori =
Quaternion::rotation_x(1.0) * Quaternion::rotation_y(wave_very_slow_cos * 0.04);
next.glider.offset = Vec3::new(0.0, -13.0 + slow * 0.10, 6.0);
next.glider.ori = Quaternion::rotation_x(1.0) * Quaternion::rotation_y(slowa * 0.04);
next.glider.scale = Vec3::one();
next.main.offset = Vec3::new(
@ -139,7 +130,7 @@ impl Animation for GlidingAnimation {
next.lantern.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, 6.0, 15.0) / 11.0 * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(-0.05 * speed.max(12.0) + wave_very_slow * 0.10)
next.torso.ori = Quaternion::rotation_x(-0.05 * speed.max(12.0) + slow * 0.10)
* Quaternion::rotation_y(tilt * 16.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;

View File

@ -17,39 +17,25 @@ impl Animation for IdleAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_ultra_slow_abs = ((anim_time as f32 * 0.5 + PI).sin()) + 1.0;
let wave_ultra_slow = (anim_time as f32 * 1.0).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI / 2.0).sin();
let head_abs = ((anim_time as f32 * 0.5 + PI).sin()) + 1.0;
/*let head_look = Vec2::new(
((global_time + anim_time) as f32 / 12.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 12.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);*/
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 14.0 + wave_ultra_slow * 0.1,
skeleton_attr.neck_height + 14.0 + wave_ultra_slow * 0.1 + head_abs * -0.5,
);
/*next.head.ori =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());*/
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * skeleton_attr.head_scale - head_abs * 0.05;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_ultra_slow * 0.1);
next.chest.ori = Quaternion::rotation_x(0.0);
next.chest.scale = Vec3::one() + wave_ultra_slow_abs * 0.05;
next.chest.scale = Vec3::one() + head_abs * 0.05;
next.belt.offset = Vec3::new(0.0, 0.0, -2.0 + wave_ultra_slow * 0.1);
next.belt.ori = Quaternion::rotation_x(0.0);
next.belt.scale = Vec3::one() + wave_ultra_slow_abs * 0.05;
next.belt.scale = Vec3::one() - head_abs * 0.05;
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0 + wave_ultra_slow * 0.1);
next.shorts.ori = Quaternion::rotation_x(0.0);
@ -67,10 +53,10 @@ impl Animation for IdleAnimation {
next.r_hand.offset = Vec3::new(
7.0,
-0.25 + wave_ultra_slow_cos * 0.15,
5.0 + wave_ultra_slow * 0.5 + wave_ultra_slow_abs * -0.05,
5.0 + wave_ultra_slow * 0.5 + head_abs * -0.05,
);
next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
next.r_hand.scale = Vec3::one() + wave_ultra_slow_abs * -0.05;
next.r_hand.scale = Vec3::one() + head_abs * -0.05;
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0);
next.l_foot.ori = Quaternion::identity();
@ -82,11 +68,11 @@ impl Animation for IdleAnimation {
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0);
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = (Vec3::one() + wave_ultra_slow_abs * -0.05) * 1.15;
next.l_shoulder.scale = (Vec3::one() + head_abs * -0.05) * 1.15;
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 5.0);
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
next.r_shoulder.scale = (Vec3::one() + wave_ultra_slow_abs * -0.05) * 1.15;
next.r_shoulder.scale = (Vec3::one() + head_abs * -0.05) * 1.15;
next.glider.offset = Vec3::new(0.0, 5.0, 0.0);
next.glider.ori = Quaternion::rotation_y(0.0);
@ -98,7 +84,7 @@ impl Animation for IdleAnimation {
18.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() + wave_ultra_slow_abs * -0.05;
next.main.scale = Vec3::one() + head_abs * -0.05;
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,

View File

@ -4,7 +4,6 @@ use std::f32::consts::PI;
use vek::*;
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = (Option<ToolKind>, f64);
type Skeleton = CharacterSkeleton;
@ -17,17 +16,16 @@ impl Animation for JumpAnimation {
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave = (anim_time as f32 * 14.0).sin();
let wave_slow = (anim_time as f32 * 7.0).sin();
let wave_stop = (anim_time as f32 * 4.5).min(PI / 2.0).sin();
let wave_stop_alt = (anim_time as f32 * 5.0).min(PI / 2.0).sin();
let quick = (anim_time as f32 * 14.0).sin();
let slow = (anim_time as f32 * 7.0).sin();
let stop = (anim_time as f32 * 1.5).min(PI / 2.0).sin();
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 13.0,
);
next.head.ori = Quaternion::rotation_x(0.25 + wave_stop * 0.1 + wave_slow * 0.04);
next.head.ori = Quaternion::rotation_x(0.25 + stop * 0.1 + slow * 0.04);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 8.0);
@ -43,37 +41,37 @@ impl Animation for JumpAnimation {
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-6.0 + wave_stop * -1.8,
-0.25 + wave_stop * 1.7,
2.0 + wave_stop * 3.2 - wave * 0.4,
-6.0 + stop * -1.8,
-0.25 + stop * 2.0,
2.0 + stop * 3.2 - quick * 0.4,
);
next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 1.2 + wave_slow * 0.2)
* Quaternion::rotation_y(wave_stop_alt * 0.2);
next.l_hand.ori =
Quaternion::rotation_x(stop * 1.2 + slow * 0.3) * Quaternion::rotation_y(stop * 0.2);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(
6.0 + wave_stop * 1.8,
-0.25 + wave_stop * -1.7,
2.0 + wave_stop * 3.2 - wave * 0.4,
6.0 + stop * 1.8,
-0.25 + stop * -2.0,
2.0 + stop * 3.2 - quick * 0.4,
);
next.r_hand.ori = Quaternion::rotation_x(-wave_stop_alt * 1.2 + wave_slow * -0.2)
* Quaternion::rotation_y(wave_stop_alt * -0.2);
next.r_hand.ori =
Quaternion::rotation_x(-stop * 1.2 + slow * -0.3) * Quaternion::rotation_y(stop * -0.2);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0);
next.l_foot.ori = Quaternion::rotation_x(wave_stop * -1.2 + wave_slow * -0.2);
next.l_foot.ori = Quaternion::rotation_x(stop * -1.2 + slow * -0.3);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, -1.0, 6.0);
next.r_foot.ori = Quaternion::rotation_x(wave_stop * 1.2 + wave_slow * 0.2);
next.r_foot.ori = Quaternion::rotation_x(stop * 1.2 + slow * 0.3);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(wave_stop_alt * 0.3);
next.l_shoulder.ori = Quaternion::rotation_x(stop * 0.3);
next.l_shoulder.scale = Vec3::one() * 1.1;
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7);
next.r_shoulder.ori = Quaternion::rotation_x(-wave_stop_alt * 0.3);
next.r_shoulder.ori = Quaternion::rotation_x(-stop * 0.3);
next.r_shoulder.scale = Vec3::one() * 1.1;
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);

View File

@ -67,7 +67,7 @@ impl Animation for ShootAnimation {
* Quaternion::rotation_y(0.5)
* Quaternion::rotation_z(-0.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(11.0, 9.0, 10.0);
next.main.offset = Vec3::new(9.2, 8.4, 13.2);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);

View File

@ -18,12 +18,10 @@ impl Animation for SitAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_stop = (anim_time as f32 * 3.0).min(PI / 2.0).sin();
let wave_slow_abs = ((anim_time as f32 * 0.5 + PI).sin()) + 1.0;
let wave_ultra_slow = (anim_time as f32 * 0.3 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 0.3 + PI).cos();
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_abs = ((anim_time as f32 * 0.3).sin()) + 1.0;
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 18.0)
@ -40,68 +38,48 @@ impl Animation for SitAnimation {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 14.0 + wave_slow * 0.1 + wave_stop * -0.8,
skeleton_attr.neck_height + 14.0 + slow * 0.1 + stop * -0.8,
);
next.head.ori =
Quaternion::rotation_z(head_look.x + wave_ultra_slow * 0.2 - wave_slow * 0.1)
* Quaternion::rotation_x(
(wave_ultra_slow_cos * -0.2 + wave_slow * 0.1 + head_look.y).abs(),
);
next.head.ori = Quaternion::rotation_z(head_look.x + slow * 0.2 - slow * 0.1)
* Quaternion::rotation_x((slowa * -0.1 + slow * 0.1 + head_look.y).abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(
0.0,
wave_stop * -0.4,
7.0 + wave_slow * 0.1 + wave_stop * -0.8,
);
next.chest.ori = Quaternion::rotation_x(wave_stop * 0.15);
next.chest.scale = Vec3::one() + wave_slow_abs * 0.05;
next.chest.offset = Vec3::new(0.0, stop * -0.4, 7.0 + slow * 0.1 + stop * -0.8);
next.chest.ori = Quaternion::rotation_x(stop * 0.15);
next.chest.scale = Vec3::one() + slow_abs * 0.05;
next.belt.offset = Vec3::new(0.0, wave_stop * 1.2, -2.0);
next.belt.ori = Quaternion::rotation_x(wave_stop * 0.3);
next.belt.scale = (Vec3::one() + wave_slow_abs * 0.05) * 1.02;
next.belt.offset = Vec3::new(0.0, stop * 1.2, -2.0);
next.belt.ori = Quaternion::rotation_x(stop * 0.3);
next.belt.scale = (Vec3::one() + slow_abs * 0.05) * 1.02;
next.shorts.offset = Vec3::new(0.0, wave_stop * 2.5, -5.0 + wave_stop * 0.6);
next.shorts.ori = Quaternion::rotation_x(wave_stop * 0.6);
next.shorts.offset = Vec3::new(0.0, stop * 2.5, -5.0 + stop * 0.6);
next.shorts.ori = Quaternion::rotation_x(stop * 0.6);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-6.0,
-0.25 + wave_ultra_slow_cos * 0.15,
7.0 + wave_ultra_slow * 0.7 + wave_stop * -2.0,
);
next.l_hand.offset = Vec3::new(-6.0, -0.25 + slowa * 0.15, 6.0 + slow * 0.7 + stop * -2.0);
next.l_hand.ori =
Quaternion::rotation_x(0.0 + wave_slow_cos * -0.1 + wave_ultra_slow * 0.1);
next.l_hand.scale = Vec3::one() + wave_slow_abs * -0.05;
next.l_hand.ori = Quaternion::rotation_x(0.0 + slowa * -0.1 + slow * 0.1);
next.l_hand.scale = Vec3::one() + slow_abs * -0.05;
next.r_hand.offset = Vec3::new(
6.0,
-0.25 + wave_ultra_slow_cos * 0.15,
7.0 + wave_ultra_slow * 0.7 + wave_stop * -2.0,
);
next.r_hand.ori =
Quaternion::rotation_x(0.0 + wave_slow * -0.1 + wave_ultra_slow_cos * 0.1);
next.r_hand.scale = Vec3::one() + wave_slow_abs * -0.05;
next.r_hand.offset = Vec3::new(6.0, -0.25 + slowa * 0.15, 6.0 + slow * 0.7 + stop * -2.0);
next.r_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.1 + slowa * 0.1);
next.r_hand.scale = Vec3::one() + slow_abs * -0.05;
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0);
next.l_foot.ori =
Quaternion::rotation_x(wave_slow * 0.1 + wave_stop * 1.2 + wave_ultra_slow * 0.1);
next.l_foot.ori = Quaternion::rotation_x(slow * 0.1 + stop * 1.2 + slow * 0.1);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0);
next.r_foot.ori = Quaternion::rotation_x(
wave_slow_cos * 0.1 + wave_stop * 1.2 + wave_ultra_slow_cos * 0.1,
);
next.r_foot.ori = Quaternion::rotation_x(slowa * 0.1 + stop * 1.2 + slowa * 0.1);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = (Vec3::one() + wave_slow_abs * -0.05) * 1.15;
next.l_shoulder.scale = (Vec3::one() + slow_abs * -0.05) * 1.15;
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7);
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
next.r_shoulder.scale = (Vec3::one() + wave_slow_abs * -0.05) * 1.15;
next.r_shoulder.scale = (Vec3::one() + slow_abs * -0.05) * 1.15;
next.glider.offset = Vec3::new(0.0, 5.0, 0.0);
next.glider.ori = Quaternion::rotation_y(0.0);
@ -113,7 +91,7 @@ impl Animation for SitAnimation {
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() + wave_slow_abs * -0.05;
next.main.scale = Vec3::one() + slow_abs * -0.05;
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,
@ -127,7 +105,7 @@ impl Animation for SitAnimation {
next.lantern.ori = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, -0.2, wave_stop * -0.16) * skeleton_attr.scaler;
next.torso.offset = Vec3::new(0.0, -0.2, stop * -0.16) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;

View File

@ -36,23 +36,23 @@ impl Animation for StandAnimation {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 14.0 + slow * 0.3, //21
skeleton_attr.neck_height + 14.0 + slow * 0.3 + breathe * -0.05,
);
next.head.ori =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * skeleton_attr.head_scale + breathe * -0.05;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 0.3);
next.chest.ori = Quaternion::rotation_z(head_look.x * 0.6);
next.chest.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * 1.01 + breathe * 0.05;
next.belt.offset = Vec3::new(0.0, 0.0, -2.0); //5
next.belt.ori = Quaternion::rotation_z(head_look.x * -0.1);
next.belt.scale = Vec3::one() + breathe * 0.05;
next.belt.scale = Vec3::one() + breathe * -0.05;
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); //2
next.shorts.ori = Quaternion::rotation_x(head_look.x * -0.2);
next.shorts.scale = Vec3::one();
next.shorts.scale = Vec3::one() + breathe * -0.05;
next.l_hand.offset = Vec3::new(-7.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5);

View File

@ -1,7 +1,6 @@
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
use common::comp::item::ToolKind;
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct WieldAnimation;
@ -96,15 +95,15 @@ impl Animation for WieldAnimation {
* Quaternion::rotation_y(0.5)
* Quaternion::rotation_z(-0.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(11.0, 9.0, 10.0);
next.main.offset = Vec3::new(9.2, 8.4, 13.2);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.offset = Vec3::new(-14.0, 1.8, 3.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_y(-0.2)
* Quaternion::rotation_z(ultra_slow_cos * 0.1);
next.control.scale = Vec3::one();
},