setup for axe/bow wield

This commit is contained in:
jshipsey 2020-10-24 17:05:13 -04:00 committed by Robin Gilh
parent 28cde31bbb
commit e6eeef4524
11 changed files with 107 additions and 130 deletions

View File

@ -92,7 +92,6 @@ impl Animation for ChargeAnimation {
next.shorts.orientation = Quaternion::rotation_z(stop * -0.7 + tilt * 4.0);
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
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);
@ -114,43 +113,25 @@ impl Animation for ChargeAnimation {
* Quaternion::rotation_z(s_a.stc.5 + stop * 0.2);
},
Some(ToolKind::Bow(_)) => {
next.hand_l.position = Vec3::new(1.0, -2.0 + stop * -1.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hand_r.position = Vec3::new(4.9, 1.0, -5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.main.position = Vec3::new(3.0, -1.0, -14.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
next.hold.orientation = Quaternion::rotation_x(-1.6)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.0);
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control.position = Vec3::new(-10.0 + stop * 13.0, 6.0 + stop * 4.0, 8.0);
next.control.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(stop * -0.4)
* Quaternion::rotation_z(stop * -0.6);
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-8.0, -2.0 + stop * -1.0, 13.0);
next.hand_l.orientation = Quaternion::rotation_x(2.1)
* Quaternion::rotation_y(0.7)
* Quaternion::rotation_z(-0.3);
next.hand_r.position = Vec3::new(-11.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(1.8)
* Quaternion::rotation_y(2.3)
* Quaternion::rotation_z(0.3);
next.main.position = Vec3::new(-12.0, 1.0, 4.0);
next.main.orientation = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(0.6);
next.control.position = Vec3::new(
3.0 + s_a.bc.0 + stop * 13.0,
-5.0 + s_a.bc.1 + stop * 4.0,
6.0 + s_a.bc.2,
);
next.control.orientation = Quaternion::rotation_x(0.2 + s_a.bc.3)
* Quaternion::rotation_y(-0.8 + s_a.bc.4 + stop * -0.4)
* Quaternion::rotation_z(s_a.bc.5 + stop * -0.6);
},
_ => {},
}
@ -170,9 +151,7 @@ impl Animation for ChargeAnimation {
s_a.foot.1 + foote * -1.5,
s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_z(0.4)
* Quaternion::rotation_y(0.0);
next.foot_r.orientation = Quaternion::rotation_z(0.4);
} else {
next.foot_l.position = Vec3::new(
-s_a.foot.0,
@ -189,13 +168,6 @@ impl Animation for ChargeAnimation {
next.foot_r.orientation =
Quaternion::rotation_x(stop * 0.1) * Quaternion::rotation_z(stop * 0.1);
}
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.orientation = Quaternion::rotation_x(-0.3);
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.lantern.scale = Vec3::one() * 0.65;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -89,6 +89,10 @@ impl Animation for IdleAnimation {
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
},
Some(ToolKind::Bow(_)) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);

View File

@ -157,6 +157,10 @@ impl Animation for JumpAnimation {
next.second.orientation =
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
},
Some(ToolKind::Bow(_)) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
next.second.orientation =

View File

@ -139,6 +139,12 @@ pub struct SkeletonAttr {
sthl: (f32, f32, f32, f32, f32, f32),
sthr: (f32, f32, f32, f32, f32, f32),
stc: (f32, f32, f32, f32, f32, f32),
ahl: (f32, f32, f32, f32, f32, f32),
ahr: (f32, f32, f32, f32, f32, f32),
ac: (f32, f32, f32, f32, f32, f32),
bhl: (f32, f32, f32, f32, f32, f32),
bhr: (f32, f32, f32, f32, f32, f32),
bc: (f32, f32, f32, f32, f32, f32),
}
impl Default for SkeletonAttr {
@ -164,6 +170,12 @@ impl Default for SkeletonAttr {
sthl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0),
sthr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
stc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
ahl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0),
ahr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
ac: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
bhl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0),
bhr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
bc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
}
}
}
@ -264,6 +276,24 @@ impl<'a> From<&'a Body> for SkeletonAttr {
stc: match (body.species, body.body_type) {
(_, _) => (-5.0, 5.0, -1.0, -0.3, 0.15, 0.0),
},
ahl: match (body.species, body.body_type) {
(_, _) => (-0.5, -1.0, 7.0, 1.87, 0.0, 0.0),
},
ahr: match (body.species, body.body_type) {
(_, _) => (0.0, -1.0, 1.0, 4.34, 0.2, 0.0),
},
ac: match (body.species, body.body_type) {
(_, _) => (-8.0, 11.0, 3.0, 2.0, 0.0, 3.14),
},
bhl: match (body.species, body.body_type) {
(_, _) => (0.0, -4.0, 1.0, 1.57, 0.0, 0.0),
},
bhr: match (body.species, body.body_type) {
(_, _) => (1.0, 2.0, -2.0, 1.57, 0.0, 0.0),
},
bc: match (body.species, body.body_type) {
(_, _) => (-5.0, 9.0, 1.0, 0.0, 1.2, -0.6),
},
}
}
}

View File

@ -3,7 +3,6 @@ use super::{
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use std::f32::consts::PI;
pub struct RollAnimation;

View File

@ -201,6 +201,10 @@ impl Animation for RunAnimation {
next.main.position = Vec3::new(2.0, -5.0, -1.0);
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
},
Some(ToolKind::Bow(_)) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation =

View File

@ -74,22 +74,23 @@ impl Animation for ShootAnimation {
* Quaternion::rotation_z(s_a.stc.5 + exp * 1.5);
},
Some(ToolKind::Bow(_)) => {
next.hand_l.position =
Vec3::new(1.0 - exp * 2.0, -4.0 - exp * 4.0, -1.0 + exp * 6.0);
next.hand_l.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6 + exp * 0.8)
* Quaternion::rotation_z(-0.3 + exp * 0.9);
next.hand_r.position = Vec3::new(4.9, 3.0, -4.0);
next.hand_r.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.main.position = Vec3::new(3.0, 2.0, -13.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.hand_l.position = Vec3::new(
s_a.bhl.0 - exp * 2.0,
s_a.bhl.1 - exp * 4.0,
s_a.bhl.2 + exp * 6.0,
);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3)
* Quaternion::rotation_y(s_a.bhl.4 + exp * 0.8)
* Quaternion::rotation_z(s_a.bhl.5 + exp * 0.9);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhl.3)
* Quaternion::rotation_y(s_a.bhr.4)
* Quaternion::rotation_z(s_a.bhr.5);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.control.position = Vec3::new(-9.0, 6.0, 8.0);
next.control.orientation = Quaternion::rotation_x(exp * 0.4);
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, 4.0 + s_a.bc.2);
next.control.orientation = Quaternion::rotation_x(s_a.bc.3 + exp * 0.4);
},
_ => {},
}
@ -129,8 +130,6 @@ impl Animation for ShootAnimation {
next.lantern.orientation =
Quaternion::rotation_x(exp * -0.7 + 0.4) * Quaternion::rotation_y(exp * 0.4);
next.hold.scale = Vec3::one() * 0.0;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -109,6 +109,10 @@ impl Animation for StandAnimation {
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
},
Some(ToolKind::Bow(_)) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
next.main.position = Vec3::new(2.0, -5.0, -1.0);
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);

View File

@ -182,6 +182,10 @@ impl Animation for SwimAnimation {
next.main.position = Vec3::new(2.0, -5.0, -1.0);
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
},
Some(ToolKind::Bow(_)) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);

View File

@ -58,7 +58,6 @@ impl Animation for SwimWieldAnimation {
let slowalt = (anim_time as f32 * 6.0 + PI).cos();
let u_slow = (anim_time as f32 * 1.0 + PI).sin();
let slow = (anim_time as f32 * 3.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();
@ -331,31 +330,6 @@ impl Animation for SwimWieldAnimation {
next.control.orientation =
Quaternion::rotation_x(u_slow * 0.2) * Quaternion::rotation_z(u_slowalt * 0.1);
},
Some(ToolKind::Farming(_)) => {
if velocity < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(-0.2 + head_look.y.abs());
next.head.scale = Vec3::one() * s_a.head_scale;
}
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation =
Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.0);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.hand_r.scale = Vec3::one() * 1.04;
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(3.14)
* Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
_ => {},
}

View File

@ -134,6 +134,9 @@ impl Animation for WieldAnimation {
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
Some(ToolKind::Axe(_)) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
if speed < 0.5 {
next.head.position =
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
@ -149,28 +152,17 @@ impl Animation for WieldAnimation {
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation =
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
next.control.orientation = Quaternion::rotation_x(1.8)
* Quaternion::rotation_y(-0.5)
* Quaternion::rotation_z(PI - 0.2);
} else {
next.control.orientation = Quaternion::rotation_x(2.1)
* Quaternion::rotation_y(-0.4)
* Quaternion::rotation_z(PI - 0.2);
}
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(0.0);
next.hand_r.position = Vec3::new(0.5, 0.0, -2.5);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(0.0);
next.main.position = Vec3::new(-0.0, -2.0, -1.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.ac.3);
next.control.position = Vec3::new(-3.0, 11.0, 3.0);
next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer(_)) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
@ -226,9 +218,7 @@ impl Animation for WieldAnimation {
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI);
@ -236,28 +226,21 @@ impl Animation for WieldAnimation {
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
Some(ToolKind::Bow(_)) => {
next.hand_l.position = Vec3::new(2.0, 1.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hand_r.position = Vec3::new(5.9, 4.5, -5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.main.position = Vec3::new(3.0, 2.0, -13.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(1.2, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.7)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-0.1);
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control.position = Vec3::new(-7.0, 6.0, 6.0);
next.control.orientation =
Quaternion::rotation_x(u_slow * 0.2) * Quaternion::rotation_z(u_slowalt * 0.1);
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.06)
* Quaternion::rotation_y(s_a.bc.4)
* Quaternion::rotation_z(s_a.bc.5 + u_slowalt * 0.1);
},
Some(ToolKind::Debug(_)) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);