mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Factor tool back animation code out
This commit is contained in:
parent
03f698034b
commit
30ecc997ea
@ -86,75 +86,14 @@ impl Animation for IdleAnimation {
|
|||||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||||
next.glider.scale = Vec3::one() * 0.0;
|
next.glider.scale = Vec3::one() * 0.0;
|
||||||
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
|
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
|
||||||
match hands {
|
|
||||||
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => match active_tool_kind {
|
|
||||||
Some(ToolKind::Bow) => {
|
|
||||||
next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
|
||||||
next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
next.main.position = Vec3::new(-7.0, -5. - skeleton.back_carry_offset, 15.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
match hands {
|
next.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.main.position = Vec3::new(-4.0, -4.0 - skeleton.back_carry_offset, 10.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
match hands {
|
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.second.position = Vec3::new(4.0, -5.0 - skeleton.back_carry_offset, 10.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||||
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
||||||
|
|
||||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
|
|
||||||
next.second.scale = match hands {
|
|
||||||
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
|
|
||||||
(_, _) => Vec3::zero(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if let (None, Some(Hands::Two)) = hands {
|
|
||||||
next.second = next.main;
|
|
||||||
}
|
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use core::f32::consts::PI;
|
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
impl Animation for JumpAnimation {
|
impl Animation for JumpAnimation {
|
||||||
@ -136,58 +135,7 @@ impl Animation for JumpAnimation {
|
|||||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||||
next.glider.scale = Vec3::one() * 0.0;
|
next.glider.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
let main_tool = if let (None, Some(Hands::Two)) = hands {
|
next.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||||
second_tool_kind
|
|
||||||
} else {
|
|
||||||
active_tool_kind
|
|
||||||
};
|
|
||||||
|
|
||||||
match main_tool {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Shield) => {
|
|
||||||
next.main.position = Vec3::new(-0.0, -5.0 - skeleton.back_carry_offset, 3.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
|
||||||
next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Bow) => {
|
|
||||||
next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
next.main.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
match second_tool_kind {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Shield) => {
|
|
||||||
next.second.position = Vec3::new(0.0, -4.5 - skeleton.back_carry_offset, 3.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
|
||||||
},
|
|
||||||
|
|
||||||
_ => {
|
|
||||||
next.second.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||||
next.lantern.orientation = Quaternion::rotation_x(1.0 * switch + slow * 0.3 * switch)
|
next.lantern.orientation = Quaternion::rotation_x(1.0 * switch + slow * 0.3 * switch)
|
||||||
@ -208,38 +156,6 @@ impl Animation for JumpAnimation {
|
|||||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
next.torso.orientation = Quaternion::rotation_x(0.0);
|
next.torso.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
match hands {
|
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.main.position = Vec3::new(-4.0, -5.0 - skeleton.back_carry_offset, 10.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
match hands {
|
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.second.position = Vec3::new(4.0, -6.0 - skeleton.back_carry_offset, 10.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
next.second.scale = match hands {
|
|
||||||
(Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(),
|
|
||||||
(_, _) => Vec3::zero(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if let (None, Some(Hands::Two)) = hands {
|
|
||||||
next.second = next.main;
|
|
||||||
}
|
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,10 @@ pub use self::{
|
|||||||
wallrun::WallrunAnimation, wield::WieldAnimation,
|
wallrun::WallrunAnimation, wield::WieldAnimation,
|
||||||
};
|
};
|
||||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton, TrailSource};
|
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton, TrailSource};
|
||||||
use common::comp;
|
use common::comp::{
|
||||||
|
self,
|
||||||
|
tool::{Hands, ToolKind},
|
||||||
|
};
|
||||||
use core::{convert::TryFrom, f32::consts::PI};
|
use core::{convert::TryFrom, f32::consts::PI};
|
||||||
|
|
||||||
pub type Body = comp::humanoid::Body;
|
pub type Body = comp::humanoid::Body;
|
||||||
@ -333,3 +336,76 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CharacterSkeleton {
|
||||||
|
pub fn do_tools_on_back(
|
||||||
|
&mut self,
|
||||||
|
hands: (Option<Hands>, Option<Hands>),
|
||||||
|
active_tool_kind: Option<ToolKind>,
|
||||||
|
second_tool_kind: Option<ToolKind>,
|
||||||
|
) {
|
||||||
|
match (hands, active_tool_kind, second_tool_kind) {
|
||||||
|
((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => match tool {
|
||||||
|
Some(ToolKind::Bow) => {
|
||||||
|
self.main.position = Vec3::new(0.0, -5.0 - self.back_carry_offset, 6.0);
|
||||||
|
self.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
|
},
|
||||||
|
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||||
|
self.main.position = Vec3::new(2.0, -5.0 - self.back_carry_offset, -1.0);
|
||||||
|
self.main.orientation =
|
||||||
|
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
self.main.position = Vec3::new(-7.0, -5.0 - self.back_carry_offset, 15.0);
|
||||||
|
self.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
((_, _), _, _) => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
match hands {
|
||||||
|
(Some(Hands::One), _) => match active_tool_kind {
|
||||||
|
Some(ToolKind::Dagger) => {
|
||||||
|
self.main.position = Vec3::new(5.0, 1.0 - self.back_carry_offset, 2.0);
|
||||||
|
self.main.orientation =
|
||||||
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
||||||
|
},
|
||||||
|
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||||
|
self.main.position = Vec3::new(-4.0, -4.5 - self.back_carry_offset, 10.0);
|
||||||
|
self.main.orientation =
|
||||||
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
|
},
|
||||||
|
Some(ToolKind::Shield) => {
|
||||||
|
self.main.position = Vec3::new(-0.0, -4.0 - self.back_carry_offset, 3.0);
|
||||||
|
self.main.orientation =
|
||||||
|
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
},
|
||||||
|
(_, _) => {},
|
||||||
|
}
|
||||||
|
match hands {
|
||||||
|
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||||
|
Some(ToolKind::Dagger) => {
|
||||||
|
self.second.position = Vec3::new(-5.0, 1.0 - self.back_carry_offset, 2.0);
|
||||||
|
self.second.orientation =
|
||||||
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
||||||
|
},
|
||||||
|
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||||
|
self.second.position = Vec3::new(4.0, -5.0 - self.back_carry_offset, 10.0);
|
||||||
|
self.second.orientation =
|
||||||
|
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
||||||
|
},
|
||||||
|
Some(ToolKind::Shield) => {
|
||||||
|
self.second.position = Vec3::new(0.0, -4.0 - self.back_carry_offset, 3.0);
|
||||||
|
self.second.orientation =
|
||||||
|
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
},
|
||||||
|
(_, _) => {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -155,59 +155,8 @@ impl Animation for MountAnimation {
|
|||||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||||
next.glider.scale = Vec3::one() * 0.0;
|
next.glider.scale = Vec3::one() * 0.0;
|
||||||
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
|
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
|
||||||
match hands {
|
|
||||||
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => match active_tool_kind {
|
|
||||||
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);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
match hands {
|
next.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(1.57);
|
|
||||||
},
|
|
||||||
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
match hands {
|
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-1.57);
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
next.second.scale = match hands {
|
|
||||||
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
|
|
||||||
(_, _) => Vec3::zero(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if let (None, Some(Hands::Two)) = hands {
|
|
||||||
next.second = next.main;
|
|
||||||
}
|
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ impl Animation for RollAnimation {
|
|||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(
|
(
|
||||||
active_tool_kind,
|
active_tool_kind,
|
||||||
_second_tool_kind,
|
second_tool_kind,
|
||||||
hands,
|
hands,
|
||||||
wield_status,
|
wield_status,
|
||||||
orientation,
|
orientation,
|
||||||
@ -206,32 +206,8 @@ impl Animation for RollAnimation {
|
|||||||
(_, _) => {},
|
(_, _) => {},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
next.hand_l.position = Vec3::new(
|
next.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||||
-s_a.hand.0,
|
}
|
||||||
s_a.hand.1 + 1.0 * movement1,
|
|
||||||
s_a.hand.2 + 2.0 * movement1,
|
|
||||||
);
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(0.6 * movement1);
|
|
||||||
|
|
||||||
next.hand_r.position = if prev_aimed_dir.is_some() {
|
|
||||||
Vec3::new(
|
|
||||||
-1.0 * movement1 + s_a.hand.0,
|
|
||||||
s_a.hand.1 + 1.0 * movement1,
|
|
||||||
s_a.hand.2 + 2.0 * movement1,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Vec3::new(
|
|
||||||
-1.0 * movement1 + s_a.hand.0 + 3.0,
|
|
||||||
s_a.hand.1 + 1.0 * movement1,
|
|
||||||
s_a.hand.2 + 2.0 * movement1 + 8.0,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
next.hand_r.orientation = if prev_aimed_dir.is_some() {
|
|
||||||
Quaternion::rotation_x(0.6 * movement1)
|
|
||||||
} else {
|
|
||||||
Quaternion::rotation_y(-1.0)
|
|
||||||
};
|
|
||||||
};
|
|
||||||
next.head.position = Vec3::new(
|
next.head.position = Vec3::new(
|
||||||
0.0,
|
0.0,
|
||||||
s_a.head.0 + 1.5 * movement1,
|
s_a.head.0 + 1.5 * movement1,
|
||||||
|
@ -230,57 +230,7 @@ impl Animation for RunAnimation {
|
|||||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||||
next.glider.scale = Vec3::one() * 0.0;
|
next.glider.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
let main_tool = if let (None, Some(Hands::Two)) = hands {
|
next.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||||
second_tool_kind
|
|
||||||
} else {
|
|
||||||
active_tool_kind
|
|
||||||
};
|
|
||||||
|
|
||||||
match main_tool {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Shield) => {
|
|
||||||
next.main.position = Vec3::new(-0.0, -5.0 - skeleton.back_carry_offset, 3.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
|
||||||
next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Bow) => {
|
|
||||||
next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
next.main.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0 + shorte * -0.2);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
match second_tool_kind {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Shield) => {
|
|
||||||
next.second.position = Vec3::new(0.0, -4.5 - skeleton.back_carry_offset, 3.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
next.second.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||||
next.lantern.orientation =
|
next.lantern.orientation =
|
||||||
@ -308,38 +258,6 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
|
|
||||||
match hands {
|
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.main.position = Vec3::new(-4.0, -4.5 - skeleton.back_carry_offset, 10.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
match hands {
|
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.second.position = Vec3::new(4.0, -5.0 - skeleton.back_carry_offset, 10.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
next.second.scale = match hands {
|
|
||||||
(Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(),
|
|
||||||
(_, _) => Vec3::zero(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if let (None, Some(Hands::Two)) = hands {
|
|
||||||
next.second = next.main;
|
|
||||||
}
|
|
||||||
if wall.map_or(false, |e| e.y > 0.5) {
|
if wall.map_or(false, |e| e.y > 0.5) {
|
||||||
let push = (1.0 - orientation.x.abs()).powi(2);
|
let push = (1.0 - orientation.x.abs()).powi(2);
|
||||||
let right_sub = -(orientation.x).min(0.0);
|
let right_sub = -(orientation.x).min(0.0);
|
||||||
|
@ -3,7 +3,6 @@ use super::{
|
|||||||
CharacterSkeleton, SkeletonAttr,
|
CharacterSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use core::f32::consts::PI;
|
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
|
|
||||||
pub struct StandAnimation;
|
pub struct StandAnimation;
|
||||||
@ -108,69 +107,8 @@ impl Animation for StandAnimation {
|
|||||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||||
next.glider.scale = Vec3::one() * 0.0;
|
next.glider.scale = Vec3::one() * 0.0;
|
||||||
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
|
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
|
||||||
match (hands, active_tool_kind, second_tool_kind) {
|
|
||||||
((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => match tool {
|
|
||||||
Some(ToolKind::Bow) => {
|
|
||||||
next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
|
||||||
next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
next.main.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
((_, _), _, _) => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
match hands {
|
next.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.main.position = Vec3::new(-4.0, -4.5 - skeleton.back_carry_offset, 10.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Shield) => {
|
|
||||||
next.main.position = Vec3::new(-0.0, -4.0 - skeleton.back_carry_offset, 3.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
match hands {
|
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.second.position = Vec3::new(4.0, -5.0 - skeleton.back_carry_offset, 10.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Shield) => {
|
|
||||||
next.second.position = Vec3::new(0.0, -4.0 - skeleton.back_carry_offset, 3.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||||
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
||||||
|
@ -171,57 +171,7 @@ impl Animation for SwimAnimation {
|
|||||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||||
next.glider.scale = Vec3::one() * 0.0;
|
next.glider.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
let main_tool = if let (None, Some(Hands::Two)) = hands {
|
next.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||||
second_tool_kind
|
|
||||||
} else {
|
|
||||||
active_tool_kind
|
|
||||||
};
|
|
||||||
|
|
||||||
match main_tool {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.main.position = Vec3::new(5.0, 1.0, 2.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Shield) => {
|
|
||||||
next.main.position = Vec3::new(-0.0, -5.0, 3.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
|
||||||
},
|
|
||||||
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(PI / 2.0);
|
|
||||||
},
|
|
||||||
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(PI / 2.0);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
match second_tool_kind {
|
|
||||||
Some(ToolKind::Dagger) => {
|
|
||||||
next.second.position = Vec3::new(-5.0, 1.0, 2.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
|
||||||
},
|
|
||||||
Some(ToolKind::Shield) => {
|
|
||||||
next.second.position = Vec3::new(0.0, -4.0, 3.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||||
next.lantern.scale = Vec3::one() * 0.65;
|
next.lantern.scale = Vec3::one() * 0.65;
|
||||||
@ -238,37 +188,6 @@ impl Animation for SwimAnimation {
|
|||||||
+ avgspeed * avg_vel.z * -0.003,
|
+ avgspeed * avg_vel.z * -0.003,
|
||||||
) * Quaternion::rotation_y(tilt * 2.0)
|
) * Quaternion::rotation_y(tilt * 2.0)
|
||||||
* Quaternion::rotation_z(tilt * 3.0);
|
* Quaternion::rotation_z(tilt * 3.0);
|
||||||
match hands {
|
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
|
||||||
next.main.orientation =
|
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
|
||||||
},
|
|
||||||
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
match hands {
|
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
|
||||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
|
||||||
next.second.orientation =
|
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
|
||||||
(_, _) => {},
|
|
||||||
};
|
|
||||||
next.second.scale = match hands {
|
|
||||||
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
|
|
||||||
(_, _) => Vec3::zero(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if let (None, Some(Hands::Two)) = hands {
|
|
||||||
next.second = next.main;
|
|
||||||
}
|
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user