mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
swimming changes
This commit is contained in:
parent
7aebff26e0
commit
691607f398
@ -8,7 +8,7 @@ edition = "2018"
|
||||
name = "voxygen_anim"
|
||||
# Uncomment to use animation hot reloading
|
||||
# Note: this breaks `cargo test`
|
||||
# crate-type = ["lib", "cdylib"]
|
||||
crate-type = ["lib", "cdylib"]
|
||||
|
||||
[features]
|
||||
use-dyn-lib = ["libloading", "notify", "lazy_static", "tracing", "find_folder"]
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::f32::consts::PI;
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
|
||||
use vek::*;
|
||||
|
||||
pub struct ClimbAnimation;
|
||||
@ -21,19 +22,20 @@ impl Animation for ClimbAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_climb")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, second_tool_kind, velocity, _orientation, _global_time): Self::Dependency,
|
||||
(active_tool_kind, second_tool_kind, velocity, _orientation, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let speed = 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 quick = (((5.0)
|
||||
/ (0.6 + 4.0 * ((anim_time as f32 * constant as f32 * 1.5).sin()).powf(2.0 as f32)))
|
||||
@ -46,145 +48,386 @@ impl Animation for ClimbAnimation {
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.5 + PI / 2.0).sin());
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-4.0 + skeleton_attr.head.0,
|
||||
skeleton_attr.head.1 + smootha * 0.2,
|
||||
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,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(smooth * 0.1)
|
||||
* Quaternion::rotation_x(0.6)
|
||||
* Quaternion::rotation_y(quick * 0.1);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
if speed > 0.7 {
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-4.0 + skeleton_attr.head.0,
|
||||
skeleton_attr.head.1 + smootha * 0.2,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(smooth * 0.1)
|
||||
* Quaternion::rotation_x(0.6)
|
||||
* Quaternion::rotation_y(quick * 0.1);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0 + 1.0,
|
||||
skeleton_attr.chest.1 + smootha * 1.1,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_z(quick * 0.25)
|
||||
* Quaternion::rotation_x(-0.15)
|
||||
* Quaternion::rotation_y(quick * -0.12);
|
||||
next.chest.scale = Vec3::one();
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + smootha * 1.1,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_z(quick * 0.25)
|
||||
* Quaternion::rotation_x(-0.15)
|
||||
* Quaternion::rotation_y(quick * -0.12);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + 1.0, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(quick * 0.0) * Quaternion::rotation_x(0.0);
|
||||
next.belt.scale = Vec3::one();
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + 1.0, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(quick * 0.0) * Quaternion::rotation_x(0.0);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
next.back.ori = Quaternion::rotation_x(-0.2);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
next.back.ori = Quaternion::rotation_x(-0.2);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0 + 1.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(quick * 0.0)
|
||||
* Quaternion::rotation_x(0.1)
|
||||
* Quaternion::rotation_y(quick * 0.10);
|
||||
next.shorts.scale = Vec3::one();
|
||||
next.shorts.offset =
|
||||
Vec3::new(0.0, skeleton_attr.shorts.0 + 1.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(quick * 0.0)
|
||||
* Quaternion::rotation_x(0.1)
|
||||
* Quaternion::rotation_y(quick * 0.10);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 + quicka * 1.5,
|
||||
5.0 + skeleton_attr.hand.2 - quick * 4.0,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_x(2.2 + quicka * 0.5);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0,
|
||||
4.0 + skeleton_attr.hand.1 + quicka * 1.5,
|
||||
5.0 + skeleton_attr.hand.2 - 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(
|
||||
skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 - quicka * 1.5,
|
||||
5.0 + skeleton_attr.hand.2 + quick * 4.0,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(2.2 - quicka * 0.5);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0,
|
||||
5.0 + skeleton_attr.hand.1 - quicka * 1.5,
|
||||
5.0 + skeleton_attr.hand.2 + 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(
|
||||
-skeleton_attr.foot.0,
|
||||
1.0 + skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2 + quick * 2.5,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(0.2 - quicka * 0.5);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
match active_tool_kind {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.main.offset = Vec3::new(-4.0, -5.0, 7.0);
|
||||
next.main.ori =
|
||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
||||
},
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
next.main.offset = Vec3::new(-0.0, -5.0, 3.0);
|
||||
next.main.ori =
|
||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||
},
|
||||
_ => {
|
||||
next.main.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
},
|
||||
}
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
1.0 + skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2 - quick * 2.5,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(0.2 + quicka * 0.5);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
match second_tool_kind {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.second.offset = Vec3::new(4.0, -6.0, 7.0);
|
||||
next.second.ori =
|
||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||
},
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
next.second.offset = Vec3::new(0.0, -4.0, 3.0);
|
||||
next.second.ori =
|
||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
||||
},
|
||||
_ => {
|
||||
next.second.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
},
|
||||
}
|
||||
next.second.scale = Vec3::one();
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
5.0 + skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2 + quick * 2.5,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(0.2 - quicka * 0.5);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(smootha * 0.15);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
4.0 + skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2 - quick * 2.5,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(0.2 + quicka * 0.5);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(smooth * 0.15);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(smootha * 0.15);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(smooth * 0.15);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
match active_tool_kind {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.main.offset = Vec3::new(-4.0, -5.0, 7.0);
|
||||
next.main.ori =
|
||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
||||
},
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
next.main.offset = Vec3::new(-0.0, -5.0, 3.0);
|
||||
next.main.ori =
|
||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||
},
|
||||
_ => {
|
||||
next.main.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.main.offset = Vec3::new(-7.0, -5.0, 18.0);
|
||||
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(0.0, 0.0, 0.0);
|
||||
next.second.ori = Quaternion::rotation_y(0.0);
|
||||
next.second.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.lantern.offset = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.lantern.ori =
|
||||
Quaternion::rotation_x(smooth * -0.3) * Quaternion::rotation_y(smooth * -0.3);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
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;
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.l_control.scale = Vec3::one();
|
||||
|
||||
next.r_control.scale = Vec3::one();
|
||||
} else {
|
||||
if speed > -0.7 {
|
||||
next.head.offset =
|
||||
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
next.head.ori = Quaternion::rotation_x(2.0 * head_look.y.abs())
|
||||
* Quaternion::rotation_z(3.5 * head_look.x.abs());
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
-2.0 + skeleton_attr.chest.0 + 3.0,
|
||||
skeleton_attr.chest.1,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_z(0.0)
|
||||
* Quaternion::rotation_x(0.3)
|
||||
* Quaternion::rotation_z(0.6);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + 0.5, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.1);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
next.back.ori = Quaternion::rotation_x(-0.2);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset =
|
||||
Vec3::new(0.0, skeleton_attr.shorts.0 + 1.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(0.0)
|
||||
* Quaternion::rotation_x(0.1)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0,
|
||||
2.0 + skeleton_attr.hand.1,
|
||||
skeleton_attr.hand.2,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.8);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0,
|
||||
5.5 + skeleton_attr.hand.1,
|
||||
5.0 + skeleton_attr.hand.2,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(2.2) * Quaternion::rotation_y(-0.5);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
5.0 + skeleton_attr.foot.1,
|
||||
1.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(0.55);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
5.0 + skeleton_attr.foot.1,
|
||||
-2.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(0.2);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.main.offset = Vec3::new(-7.0, -5.0, 18.0);
|
||||
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
},
|
||||
}
|
||||
next.main.scale = Vec3::one();
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
match second_tool_kind {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.second.offset = Vec3::new(4.0, -6.0, 7.0);
|
||||
next.second.ori =
|
||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||
},
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
next.second.offset = Vec3::new(0.0, -4.0, 3.0);
|
||||
next.second.ori =
|
||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
||||
},
|
||||
_ => {
|
||||
next.second.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
},
|
||||
}
|
||||
next.second.scale = Vec3::one();
|
||||
next.second.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.ori = Quaternion::rotation_y(0.0);
|
||||
next.second.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.lantern.offset = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.lantern.ori =
|
||||
Quaternion::rotation_x(smooth * -0.3) * Quaternion::rotation_y(smooth * -0.3);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
next.lantern.offset = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.lantern.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
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;
|
||||
next.torso.offset = Vec3::new(0.0, -0.2, 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;
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.l_control.scale = Vec3::one();
|
||||
next.l_control.scale = Vec3::one();
|
||||
|
||||
next.r_control.scale = Vec3::one();
|
||||
} else {
|
||||
next.head.offset =
|
||||
Vec3::new(0.0, -1.0 + skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
next.head.ori = Quaternion::rotation_x(-0.25) * Quaternion::rotation_z(0.0);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
-2.0 + skeleton_attr.chest.0 + 3.0,
|
||||
skeleton_attr.chest.1,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_z(0.0)
|
||||
* Quaternion::rotation_x(0.2 + drop * 0.05)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + 0.5, skeleton_attr.belt.1);
|
||||
next.belt.ori =
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.1 + dropa * 0.1);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
next.back.ori = Quaternion::rotation_x(-0.15);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset =
|
||||
Vec3::new(0.0, skeleton_attr.shorts.0 + 1.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(0.0)
|
||||
* Quaternion::rotation_x(0.1 + dropa * 0.12)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0,
|
||||
7.5 + skeleton_attr.hand.1,
|
||||
7.0 + skeleton_attr.hand.2 + dropa * -1.0,
|
||||
);
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(2.2) * Quaternion::rotation_y(0.3 + dropa * 0.1);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0,
|
||||
7.5 + skeleton_attr.hand.1,
|
||||
5.0 + skeleton_attr.hand.2 + drop * -1.0,
|
||||
);
|
||||
next.r_hand.ori =
|
||||
Quaternion::rotation_x(2.2) * Quaternion::rotation_y(-0.3 + drop * 0.1);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
4.0 + skeleton_attr.foot.1,
|
||||
1.0 + skeleton_attr.foot.2 + drop * -2.0,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(0.55 + drop * 0.1);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
2.0 + skeleton_attr.foot.1,
|
||||
-2.0 + skeleton_attr.foot.2 + smooth * 1.0,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(0.2 + smooth * 0.15);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.main.offset = Vec3::new(-7.0, -5.0, 18.0);
|
||||
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.second.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.ori = Quaternion::rotation_y(0.0);
|
||||
next.second.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.lantern.offset = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.lantern.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, -0.2, 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;
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.l_control.scale = Vec3::one();
|
||||
}
|
||||
};
|
||||
next.r_control.scale = Vec3::one();
|
||||
|
||||
next.second.scale = match (
|
||||
|
@ -48,17 +48,17 @@ impl Animation for RunAnimation {
|
||||
let footvertl = (anim_time as f32 * 16.0 * walk * lab as f32).sin();
|
||||
let footvertr = (anim_time as f32 * 16.0 * walk * lab as f32 + PI).sin();
|
||||
|
||||
let footrotl = (((5.0)
|
||||
/ (2.5
|
||||
+ (2.5)
|
||||
let footrotl = (((1.0)
|
||||
/ (0.5
|
||||
+ (0.5)
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin());
|
||||
|
||||
let footrotr = (((5.0)
|
||||
/ (1.0
|
||||
+ (4.0)
|
||||
let footrotr = (((1.0)
|
||||
/ (0.5
|
||||
+ (0.5)
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 0.4).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
|
@ -12,6 +12,7 @@ type SwimAnimationDependency = (
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
Vec3<f32>,
|
||||
);
|
||||
|
||||
impl Animation for SwimAnimation {
|
||||
@ -25,17 +26,19 @@ impl Animation for SwimAnimation {
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
|
||||
(active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
let speed = Vec3::<f32>::from(velocity).magnitude();
|
||||
*rate = 1.0;
|
||||
let tempo = if speed > 0.5 { 1.0 } else { 0.7 };
|
||||
let intensity = if speed > 0.5 { 1.0 } else { 0.3 };
|
||||
|
||||
let lab = 1.0;
|
||||
let lab = 1.0 * tempo;
|
||||
|
||||
let short = (anim_time as f32 * lab as f32 * 6.0).sin();
|
||||
|
||||
@ -45,13 +48,29 @@ impl Animation for SwimAnimation {
|
||||
|
||||
let wave_stop = (anim_time as f32 * 9.0).min(PI / 2.0 / 2.0).sin();
|
||||
|
||||
let footrotl = (((1.0)
|
||||
/ (0.2
|
||||
+ (0.8)
|
||||
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 6.0 * lab as f32 + 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()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).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 head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 18.0)
|
||||
((global_time + anim_time) as f32 / 4.0 * (1.0 / tempo))
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.2,
|
||||
((global_time + anim_time) as f32 / 18.0)
|
||||
((global_time + anim_time) as f32 / 4.0 * (1.0 / tempo))
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
@ -70,25 +89,32 @@ impl Animation for SwimAnimation {
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
|
||||
let adjust = if speed > 0.5 { -1.57 } else { -3.14 * speed };
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-3.0 + skeleton_attr.head.0,
|
||||
skeleton_attr.head.1 - 1.0 + short * 0.3,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x - short * 0.4)
|
||||
* Quaternion::rotation_x(head_look.y + 0.35 + speed * 0.045);
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x + short * -0.6 * intensity)
|
||||
* Quaternion::rotation_x(
|
||||
(0.6 * head_look.y * (1.0 / intensity)).abs()
|
||||
+ 0.45 * intensity
|
||||
+ velocity.z * 0.02,
|
||||
);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + short * 1.3,
|
||||
-13.0 + skeleton_attr.chest.1 + short * 1.3 * intensity,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_z(short * 0.4);
|
||||
next.chest.ori = Quaternion::rotation_z(short * 0.4 * intensity);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(short * 0.30);
|
||||
next.belt.ori = Quaternion::rotation_x(velocity.z * 0.01)
|
||||
* Quaternion::rotation_z(short * 0.2 * intensity);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
@ -96,39 +122,42 @@ impl Animation for SwimAnimation {
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(short * 0.5);
|
||||
next.shorts.ori = Quaternion::rotation_x(velocity.z * 0.02)
|
||||
* Quaternion::rotation_z(short * 0.3 * intensity);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0,
|
||||
1.5 + skeleton_attr.hand.1 - foot * 1.2,
|
||||
2.0 + skeleton_attr.hand.2 + foot * -3.0,
|
||||
1.5 + skeleton_attr.hand.1 - foot * 1.2 * intensity,
|
||||
2.0 + skeleton_attr.hand.2 + foot * -3.0 * intensity,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.8 + foot * -0.6) * Quaternion::rotation_y(0.2);
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(0.8 + foot * -0.6 * intensity) * Quaternion::rotation_y(0.2);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0,
|
||||
1.5 + skeleton_attr.hand.1 + foot * 1.2,
|
||||
2.0 + skeleton_attr.hand.2 + foot * 3.0,
|
||||
1.5 + skeleton_attr.hand.1 + foot * 1.2 * intensity,
|
||||
2.0 + skeleton_attr.hand.2 + foot * 3.0 * intensity,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.8 + foot * 0.6) * Quaternion::rotation_y(-0.2);
|
||||
next.r_hand.ori =
|
||||
Quaternion::rotation_x(0.8 + foot * 0.6 * intensity) * Quaternion::rotation_y(-0.2);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + foot * 1.2,
|
||||
-3.0 + skeleton_attr.foot.2 + foot * 3.5,
|
||||
skeleton_attr.foot.1 + foothorir * 1.5 * intensity,
|
||||
-15.0 + skeleton_attr.foot.2 + footrotl * 3.0 * intensity,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-1.1 + foot * 0.6);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.8 + footrotl * 0.4 * intensity);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 - foot * 1.2,
|
||||
-3.0 + skeleton_attr.foot.2 + foot * -3.5,
|
||||
skeleton_attr.foot.1 + foothorir * 1.5 * intensity,
|
||||
-15.0 + skeleton_attr.foot.2 + footrotr * 3.0 * intensity,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-1.1 + foot * -0.6);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.8 + footrotr * 0.4 * intensity);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
@ -136,7 +165,7 @@ impl Animation for SwimAnimation {
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(short * 0.15);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(short * 0.15 * intensity);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
@ -144,7 +173,7 @@ impl Animation for SwimAnimation {
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(short * -0.15);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(short * -0.15 * intensity);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);
|
||||
@ -194,9 +223,9 @@ impl Animation for SwimAnimation {
|
||||
next.lantern.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, -1.2 + shortalt * -0.065, 0.4) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05)
|
||||
* Quaternion::rotation_z(tilt * 12.0);
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 1.0) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_x(adjust + avg_vel.z * 0.12)
|
||||
* Quaternion::rotation_z(tilt * 12.0 + short * 0.4 * intensity);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
|
@ -636,6 +636,7 @@ impl FigureMgr {
|
||||
ori,
|
||||
state.last_ori,
|
||||
time,
|
||||
state.avg_vel,
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
|
@ -322,8 +322,11 @@ impl PlayState for SessionState {
|
||||
Event::InputUpdate(GameInput::Jump, state) => {
|
||||
self.inputs.jump.set_state(state);
|
||||
},
|
||||
Event::InputUpdate(GameInput::Swim, state) => {
|
||||
self.inputs.swim.set_state(state);
|
||||
Event::InputUpdate(GameInput::SwimUp, state) => {
|
||||
self.inputs.swimup.set_state(state);
|
||||
},
|
||||
Event::InputUpdate(GameInput::SwimDown, state) => {
|
||||
self.inputs.swimdown.set_state(state);
|
||||
},
|
||||
Event::InputUpdate(GameInput::Sit, state)
|
||||
if state != self.key_state.toggle_sit =>
|
||||
|
@ -134,7 +134,8 @@ impl ControlSettings {
|
||||
GameInput::Glide => KeyMouse::Key(VirtualKeyCode::LShift),
|
||||
GameInput::Climb => KeyMouse::Key(VirtualKeyCode::Space),
|
||||
GameInput::ClimbDown => KeyMouse::Key(VirtualKeyCode::LControl),
|
||||
GameInput::Swim => KeyMouse::Key(VirtualKeyCode::Space),
|
||||
GameInput::SwimUp => KeyMouse::Key(VirtualKeyCode::Space),
|
||||
GameInput::SwimDown => KeyMouse::Key(VirtualKeyCode::LShift),
|
||||
//GameInput::WallLeap => MIDDLE_CLICK_KEY,
|
||||
GameInput::ToggleLantern => KeyMouse::Key(VirtualKeyCode::G),
|
||||
GameInput::Mount => KeyMouse::Key(VirtualKeyCode::F),
|
||||
@ -199,7 +200,8 @@ impl Default for ControlSettings {
|
||||
GameInput::Glide,
|
||||
GameInput::Climb,
|
||||
GameInput::ClimbDown,
|
||||
GameInput::Swim,
|
||||
GameInput::SwimUp,
|
||||
GameInput::SwimDown,
|
||||
//GameInput::WallLeap,
|
||||
GameInput::ToggleLantern,
|
||||
GameInput::Mount,
|
||||
@ -308,7 +310,8 @@ pub mod con_settings {
|
||||
pub glide: Button,
|
||||
pub climb: Button,
|
||||
pub climb_down: Button,
|
||||
pub swim: Button,
|
||||
pub swimup: Button,
|
||||
pub swimdown: Button,
|
||||
//pub wall_leap: Button,
|
||||
pub toggle_lantern: Button,
|
||||
pub mount: Button,
|
||||
@ -398,7 +401,8 @@ pub mod con_settings {
|
||||
glide: Button::Simple(GilButton::LeftTrigger),
|
||||
climb: Button::Simple(GilButton::South),
|
||||
climb_down: Button::Simple(GilButton::Unknown),
|
||||
swim: Button::Simple(GilButton::South),
|
||||
swimup: Button::Simple(GilButton::South),
|
||||
swimdown: Button::Simple(GilButton::Unknown),
|
||||
//wall_leap: Button::Simple(GilButton::Unknown),
|
||||
toggle_lantern: Button::Simple(GilButton::East),
|
||||
mount: Button::Simple(GilButton::North),
|
||||
|
@ -39,7 +39,8 @@ pub enum GameInput {
|
||||
Glide,
|
||||
Climb,
|
||||
ClimbDown,
|
||||
Swim,
|
||||
SwimUp,
|
||||
SwimDown,
|
||||
//WallLeap,
|
||||
ToggleLantern,
|
||||
Mount,
|
||||
@ -88,7 +89,8 @@ impl GameInput {
|
||||
GameInput::Glide => "gameinput.glide",
|
||||
GameInput::Climb => "gameinput.climb",
|
||||
GameInput::ClimbDown => "gameinput.climbdown",
|
||||
GameInput::Swim => "gameinput.swim",
|
||||
GameInput::SwimUp => "gameinput.swimup",
|
||||
GameInput::SwimDown => "gameinput.swimdown",
|
||||
//GameInput::WallLeap => "gameinput.wallleap",
|
||||
GameInput::ToggleLantern => "gameinput.togglelantern",
|
||||
GameInput::Mount => "gameinput.mount",
|
||||
@ -147,7 +149,8 @@ impl GameInput {
|
||||
GameInput::Glide,
|
||||
GameInput::Climb,
|
||||
GameInput::ClimbDown,
|
||||
GameInput::Swim,
|
||||
GameInput::SwimUp,
|
||||
GameInput::SwimDown,
|
||||
GameInput::ToggleLantern,
|
||||
GameInput::Mount,
|
||||
GameInput::Enter,
|
||||
@ -201,7 +204,7 @@ impl GameInput {
|
||||
match self {
|
||||
GameInput::Jump => GameInput::Jump,
|
||||
GameInput::Climb => GameInput::Jump,
|
||||
GameInput::Swim => GameInput::Jump,
|
||||
GameInput::SwimUp => GameInput::Jump,
|
||||
GameInput::Respawn => GameInput::Jump,
|
||||
|
||||
GameInput::FreeLook => GameInput::FreeLook,
|
||||
|
Loading…
Reference in New Issue
Block a user