mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'animation-tweaks' into 'master'
animation and movement tweaks See merge request veloren/veloren!389
This commit is contained in:
commit
51fa4f3cfc
@ -9,10 +9,12 @@ use vek::*;
|
||||
|
||||
const HUMANOID_ACCEL: f32 = 70.0;
|
||||
const HUMANOID_SPEED: f32 = 120.0;
|
||||
const WIELD_ACCEL: f32 = 60.0;
|
||||
const WIELD_SPEED: f32 = 100.0;
|
||||
const HUMANOID_AIR_ACCEL: f32 = 10.0;
|
||||
const HUMANOID_AIR_SPEED: f32 = 100.0;
|
||||
const HUMANOID_JUMP_ACCEL: f32 = 18.0;
|
||||
const ROLL_ACCEL: f32 = 120.0;
|
||||
const ROLL_ACCEL: f32 = 160.0;
|
||||
const ROLL_SPEED: f32 = 550.0;
|
||||
const GLIDE_ACCEL: f32 = 15.0;
|
||||
const GLIDE_SPEED: f32 = 45.0;
|
||||
@ -79,26 +81,32 @@ impl<'a> System<'a> for Sys {
|
||||
if let Some(move_dir) = move_dir {
|
||||
vel.0 += Vec2::broadcast(dt.0)
|
||||
* move_dir.0
|
||||
* match (a.on_ground, a.gliding, a.rolling) {
|
||||
(true, false, false)
|
||||
* match (a.on_ground, a.gliding, a.rolling, a.wielding) {
|
||||
(true, false, false, false)
|
||||
if vel.0.magnitude_squared() < HUMANOID_SPEED.powf(2.0) =>
|
||||
{
|
||||
HUMANOID_ACCEL
|
||||
}
|
||||
(false, true, false)
|
||||
(false, true, false, false)
|
||||
if vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) =>
|
||||
{
|
||||
GLIDE_ACCEL
|
||||
}
|
||||
(false, false, false)
|
||||
(false, false, false, false)
|
||||
if vel.0.magnitude_squared() < HUMANOID_AIR_SPEED.powf(2.0) =>
|
||||
{
|
||||
HUMANOID_AIR_ACCEL
|
||||
}
|
||||
(true, false, true) if vel.0.magnitude_squared() < ROLL_SPEED.powf(2.0) => {
|
||||
(true, false, true, false)
|
||||
if vel.0.magnitude_squared() < ROLL_SPEED.powf(2.0) =>
|
||||
{
|
||||
ROLL_ACCEL
|
||||
}
|
||||
|
||||
(true, false, false, true)
|
||||
if vel.0.magnitude_squared() < WIELD_SPEED.powf(2.0) =>
|
||||
{
|
||||
WIELD_ACCEL
|
||||
}
|
||||
_ => 0.0,
|
||||
};
|
||||
}
|
||||
@ -120,7 +128,7 @@ impl<'a> System<'a> for Sys {
|
||||
if let Some(time) = rollings.get_mut(entity).map(|r| &mut r.time) {
|
||||
let _ = wieldings.remove(entity);
|
||||
*time += dt.0;
|
||||
if *time > 0.55 || !a.moving {
|
||||
if *time > 0.6 || !a.moving {
|
||||
rollings.remove(entity);
|
||||
}
|
||||
}
|
||||
|
@ -24,8 +24,10 @@ impl Animation for CrunAnimation {
|
||||
let wave = (anim_time as f32 * 12.0).sin();
|
||||
let wave_cos = (anim_time as f32 * 12.0).cos();
|
||||
let wave_diff = (anim_time as f32 * 12.0 + PI / 2.0).sin();
|
||||
let wave_cos_dub = (anim_time as f32 * 24.0).cos();
|
||||
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin();
|
||||
let wave_dub = (anim_time as f32 * 16.0).sin();
|
||||
let wave_cos_dub = (anim_time as f32 * 16.0).cos();
|
||||
let wave_cos_foot = (anim_time as f32 * 14.0).cos();
|
||||
let wave_stop = (anim_time as f32 * 5.0).min(PI / 2.0).sin();
|
||||
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 2.0)
|
||||
@ -42,7 +44,7 @@ impl Animation for CrunAnimation {
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-1.0 + skeleton_attr.neck_forward,
|
||||
0.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 15.0 + wave_cos * 1.3,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1)
|
||||
@ -54,11 +56,11 @@ impl Animation for CrunAnimation {
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_cos * 1.1);
|
||||
next.belt.ori = Quaternion::rotation_z(wave * 0.25);
|
||||
next.belt.ori = Quaternion::rotation_z(wave * 0.18);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_cos * 1.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.4);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
match Tool::Hammer {
|
||||
@ -187,12 +189,12 @@ impl Animation for CrunAnimation {
|
||||
next.weapon.scale = Vec3::one();
|
||||
}
|
||||
}
|
||||
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0 - wave_cos_dub * 0.11);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.5);
|
||||
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 7.2 - wave_dub * 0.25);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos_foot * 0.6);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0 - wave_cos_dub * 0.11);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5);
|
||||
next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 7.2 - wave_cos_dub * 0.25);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos_foot * 0.6);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||
@ -207,10 +209,9 @@ impl Animation for CrunAnimation {
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.torso.offset =
|
||||
Vec3::new(0.0, -0.2 + wave * -0.08, 0.4 + wave_cos_dub * 0.11) * skeleton_attr.scaler;
|
||||
next.torso.offset = Vec3::new(0.0, -0.2 + wave * -0.08, 0.2) * skeleton_attr.scaler;
|
||||
next.torso.ori =
|
||||
Quaternion::rotation_x(wave_stop * velocity * -0.06 + wave_diff * velocity * -0.005);
|
||||
Quaternion::rotation_x(wave_stop * velocity * -0.04 + wave_diff * velocity * -0.005);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next
|
||||
|
@ -27,22 +27,22 @@ impl Animation for RollAnimation {
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + skeleton_attr.neck_right,
|
||||
-2.0 + wave_slow * -3.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 9.0 + wave_dub * -5.0,
|
||||
0.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 15.0 + wave_dub * -8.0,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_x(wave_dub * -0.4);
|
||||
next.head.ori = Quaternion::rotation_x(wave_dub * 0.4);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_dub * -2.5);
|
||||
next.chest.ori = Quaternion::rotation_x(wave_dub * -0.5 + wave_slow * 4.0);
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_dub * -5.0);
|
||||
next.chest.ori = Quaternion::rotation_x(wave_dub * 0.4);
|
||||
next.chest.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
|
||||
next.belt.ori = Quaternion::rotation_x(0.0 + wave_slow * 4.0);
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_dub * -3.0);
|
||||
next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.0 + wave_slow * 4.0);
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_dub * -2.0);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
|
@ -76,11 +76,11 @@ impl Animation for RunAnimation {
|
||||
next.r_hand.ori = Quaternion::rotation_x(wave_cos * -0.8);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0 - wave_cos_dub * 0.11);
|
||||
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0 - wave_cos_dub * 0.7);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.5);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0 - wave_cos_dub * 0.11);
|
||||
next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0 - wave_cos_dub * 0.7);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
@ -106,7 +106,7 @@ impl Animation for RunAnimation {
|
||||
next.draw.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.torso.offset =
|
||||
Vec3::new(0.0, -0.2 + wave * -0.08, 0.4 + wave_cos_dub * 0.11) * skeleton_attr.scaler;
|
||||
Vec3::new(0.0, -0.2 + wave * -0.08, 0.4 + wave_cos_dub * 0.07) * skeleton_attr.scaler;
|
||||
next.torso.ori =
|
||||
Quaternion::rotation_x(wave_stop * velocity * -0.06 + wave_diff * velocity * -0.005);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
Loading…
Reference in New Issue
Block a user