some stuff fixed, other stuff still broken

This commit is contained in:
jshipsey 2019-08-26 23:04:54 -04:00
parent cd3e340647
commit bec942753e
6 changed files with 172 additions and 62 deletions

View File

@ -32,15 +32,15 @@ impl<'a> System<'a> for Sys {
}
let animation = match (physics.on_ground, &character.movement, &character.action) {
(_, Roll { .. }, Idle) => Animation::Roll,
(true, Stand, _) => Animation::Stand, //if standing still, legs still
(true, Stand, Idle) => Animation::Idle, //if standing still and not acting, idle the body
(true, Run, _) => Animation::Run, //if running, legs run
(true, Run, Idle) => Animation::Lean, //if running and not acting, lean the body
(false, Jump, Idle) => Animation::Jump,
(true, Stand, Wield { .. }) => Animation::Cidle,
(true, Run, Wield { .. }) => Animation::Crun,
(false, Jump, Wield { .. }) => Animation::Cjump,
//(_, Roll { .. }, _) => Animation::Roll,
//(true, Stand, _) => Animation::Stand, //if standing still, legs still
//(true, Stand, Idle) => Animation::Idle, //if standing still and not acting, idle the body
//(true, Run, _) => Animation::Run, //if running, legs run
//(true, Run, Idle) => Animation::Lean, //if running and not acting, lean the body
//(false, Jump, Idle) => Animation::Jump,
//(true, Stand, Wield { .. }) => Animation::Cidle,
//(true, Run, Wield { .. }) => Animation::Crun,
//(false, Jump, Wield { .. }) => Animation::Cjump,
(_, Glide, Idle) => Animation::Gliding,
(_, _, Attack { .. }) => Animation::Attack,
(_, _, Block { .. }) => Animation::Block,

View File

@ -224,13 +224,13 @@ impl Animation for BlockAnimation {
next.weapon.scale = Vec3::one();
}
}
next.l_foot.offset = Vec3::new(-3.4, 0.3, 8.0 + wave_ultra_slow_cos * 0.1);
next.l_foot.ori = Quaternion::rotation_x(-0.3);
next.l_foot.scale = Vec3::one();
//next.l_foot.offset = Vec3::new(-3.4, 0.3, 8.0 + wave_ultra_slow_cos * 0.1);
//next.l_foot.ori = Quaternion::rotation_x(-0.3);
//next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 1.2, 8.0 + wave_ultra_slow * 0.1);
next.r_foot.ori = Quaternion::rotation_x(0.3);
next.r_foot.scale = Vec3::one();
//next.r_foot.offset = Vec3::new(3.4, 1.2, 8.0 + wave_ultra_slow * 0.1);
//next.r_foot.ori = Quaternion::rotation_x(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(0.0);

View File

@ -40,26 +40,6 @@ impl Animation for CrunAnimation {
* 0.1,
);
next.head.offset = Vec3::new(
0.0,
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)
* Quaternion::rotation_x(head_look.y + 0.35);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 1.1);
next.chest.ori = Quaternion::rotation_z(wave * 0.15);
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.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.4);
next.shorts.scale = Vec3::one();
match Tool::Hammer {
//TODO: Inventory
@ -187,30 +167,6 @@ 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.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.7);
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.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.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.scale = Vec3::one() * 1.1;
next.draw.offset = Vec3::new(0.0, 5.0, 0.0);
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.2) * skeleton_attr.scaler;
next.torso.ori =
Quaternion::rotation_x(wave_stop * velocity * -0.04 + wave_diff * velocity * -0.005);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next
}

View File

@ -25,6 +25,54 @@ impl Animation for RunAnimation {
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 head_look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
);
next.head.offset = Vec3::new(
0.0,
-1.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)
* Quaternion::rotation_x(head_look.y + 0.35);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 1.1);
next.chest.ori = Quaternion::rotation_z(wave * 0.2);
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.35);
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.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-7.5 + wave_cos_dub * 1.0,
2.0 + wave_cos * 5.0,
0.0 - wave * 1.5,
);
next.l_hand.ori = Quaternion::rotation_x(wave_cos * 0.8);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(
7.5 - wave_cos_dub * 1.0,
2.0 - wave_cos * 5.0,
0.0 + wave * 1.5,
);
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.7);
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.5);
@ -34,6 +82,33 @@ impl Animation for RunAnimation {
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5);
next.r_foot.scale = Vec3::one();
next.weapon.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.weapon.ori =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
next.weapon.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.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.scale = Vec3::one() * 1.1;
next.draw.offset = Vec3::new(0.0, 5.0, 0.0);
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) * 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;
next
}
}

View File

@ -22,6 +22,59 @@ impl Animation for StandAnimation {
) -> 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 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,
0.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 15.0 + wave_ultra_slow * 0.3,
);
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.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_ultra_slow * 0.3);
next.chest.ori = Quaternion::rotation_x(0.0);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_ultra_slow * 0.3);
next.belt.ori = Quaternion::rotation_x(0.0);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_ultra_slow * 0.3);
next.shorts.ori = Quaternion::rotation_x(0.0);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-7.5,
0.0 + wave_ultra_slow_cos * 0.15,
0.0 + wave_ultra_slow * 0.5,
);
next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(
7.5,
0.0 + wave_ultra_slow_cos * 0.15,
0.0 + wave_ultra_slow * 0.5,
);
next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0);
next.l_foot.ori = Quaternion::identity();
@ -31,6 +84,31 @@ impl Animation for StandAnimation {
next.r_foot.ori = Quaternion::identity();
next.r_foot.scale = Vec3::one();
next.weapon.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.weapon.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.weapon.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() * 1.1;
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() * 1.1;
next.draw.offset = Vec3::new(0.0, 5.0, 0.0);
next.draw.ori = Quaternion::rotation_y(0.0);
next.draw.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next
}
}

View File

@ -701,7 +701,7 @@ impl FigureMgr {
let time_since_movement_change =
state.last_movement_change.elapsed().as_secs_f64();
let time_since_action_change = state.last_action_change.elapsed().as_secs_f64();
let target_base = match &character.movement {
Stand => anim::character::StandAnimation::update_skeleton(
&CharacterSkeleton::new(),
@ -736,9 +736,10 @@ impl FigureMgr {
};
let target_bones = match (&character.movement, &character.action) {
(_, Wield { .. }) => anim::character::CidleAnimation::update_skeleton(
(_, Wield { .. }) => anim::character::CrunAnimation::update_skeleton(
&target_base,
time,
(vel.0.magnitude(), time),
time_since_action_change,
skeleton_attr,
),