mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'zesterer/backpack-fixes' into 'master'
Added wielding for wallrunning See merge request veloren/veloren!4133
This commit is contained in:
commit
0d5017932d
@ -177,6 +177,7 @@ impl CharacterState {
|
||||
was_wielded: true,
|
||||
..
|
||||
})
|
||||
| CharacterState::Wallrun(wallrun::Data { was_wielded: true })
|
||||
| CharacterState::Stunned(stunned::Data {
|
||||
was_wielded: true,
|
||||
..
|
||||
@ -194,6 +195,7 @@ impl CharacterState {
|
||||
CharacterState::Stunned(data) => data.was_wielded,
|
||||
CharacterState::SpriteInteract(data) => data.static_data.was_wielded,
|
||||
CharacterState::UseItem(data) => data.static_data.was_wielded,
|
||||
CharacterState::Wallrun(data) => data.was_wielded,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -895,7 +895,9 @@ pub fn handle_wallrun(data: &JoinData<'_>, update: &mut StateUpdate) -> bool {
|
||||
&& data.physics.in_liquid().is_none()
|
||||
&& data.body.can_climb()
|
||||
{
|
||||
update.character = CharacterState::Wallrun(wallrun::Data);
|
||||
update.character = CharacterState::Wallrun(wallrun::Data {
|
||||
was_wielded: data.character.is_wield() || data.character.was_wielded(),
|
||||
});
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
@ -3,7 +3,7 @@ use crate::{
|
||||
comp::{character_state::OutputEvents, CharacterState, StateUpdate},
|
||||
states::{
|
||||
behavior::{CharacterBehavior, JoinData},
|
||||
idle,
|
||||
idle, wielding,
|
||||
},
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -12,7 +12,10 @@ use vek::Vec2;
|
||||
const WALLRUN_ANTIGRAV: f32 = crate::consts::GRAVITY * 0.5;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
|
||||
pub struct Data;
|
||||
pub struct Data {
|
||||
/// Had weapon
|
||||
pub was_wielded: bool,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
|
||||
@ -36,7 +39,11 @@ impl CharacterBehavior for Data {
|
||||
|| data.physics.on_ground.is_some()
|
||||
|| data.physics.in_liquid().is_some()
|
||||
{
|
||||
update.character = CharacterState::Idle(idle::Data::default());
|
||||
update.character = if self.was_wielded {
|
||||
CharacterState::Wielding(wielding::Data { is_sneaking: false })
|
||||
} else {
|
||||
CharacterState::Idle(idle::Data::default())
|
||||
};
|
||||
}
|
||||
|
||||
update
|
||||
|
@ -26,6 +26,7 @@ impl CharacterBehavior for Data {
|
||||
handle_climb(data, &mut update);
|
||||
attempt_input(data, output_events, &mut update);
|
||||
handle_jump(data, output_events, &mut update, 1.0);
|
||||
handle_wallrun(data, &mut update);
|
||||
|
||||
if self.is_sneaking
|
||||
&& (data.physics.on_ground.is_none() || data.physics.in_liquid().is_some())
|
||||
|
@ -29,7 +29,7 @@ impl Animation for GlidingAnimation {
|
||||
next.glider_trails = true;
|
||||
|
||||
let speednorm = velocity.magnitude().min(50.0) / 50.0;
|
||||
let slow = (acc_vel * 0.25).sin();
|
||||
let slow = (acc_vel * 0.1).sin();
|
||||
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) / 4.0).floor().mul(7331.0).sin() * 0.5,
|
||||
@ -53,10 +53,9 @@ impl Animation for GlidingAnimation {
|
||||
|
||||
//necessary for overwriting jump anim
|
||||
next.belt.orientation = Quaternion::rotation_z(0.0);
|
||||
next.shorts.orientation = Quaternion::rotation_z(0.0);
|
||||
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
|
||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
|
||||
next.shorts.orientation = Quaternion::rotation_z(-speedlog + slow * 0.15);
|
||||
next.shorts.orientation = Quaternion::rotation_z(slow * 0.15);
|
||||
|
||||
next.shoulder_r.orientation = glider_ori * Quaternion::rotation_x(2.0);
|
||||
next.shoulder_l.orientation = next.shoulder_r.orientation;
|
||||
|
@ -3,7 +3,6 @@ use super::{
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use core::f32::consts::PI;
|
||||
use std::ops::Mul;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
@ -41,7 +40,6 @@ impl Animation for IdleAnimation {
|
||||
next.hand_r.scale = Vec3::one() * 1.04;
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
next.shoulder_l.scale = Vec3::one() * 1.1;
|
||||
next.shoulder_r.scale = Vec3::one() * 1.1;
|
||||
|
||||
@ -86,75 +84,13 @@ impl Animation for IdleAnimation {
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
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 {
|
||||
(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);
|
||||
},
|
||||
next.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||
|
||||
_ => {},
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
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.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
||||
next.do_hold_lantern(s_a, anim_time, 0.0, 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
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ use super::{
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
impl Animation for JumpAnimation {
|
||||
@ -136,110 +135,13 @@ impl Animation for JumpAnimation {
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
|
||||
let main_tool = if let (None, Some(Hands::Two)) = hands {
|
||||
second_tool_kind
|
||||
} else {
|
||||
active_tool_kind
|
||||
};
|
||||
next.do_tools_on_back(hands, active_tool_kind, second_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.orientation = Quaternion::rotation_x(1.0 * switch + slow * 0.3 * switch)
|
||||
* Quaternion::rotation_y(0.6 * switch + slow * 0.3 * switch);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1 + 5.0, s_a.hand.2 + 9.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9);
|
||||
|
||||
next.lantern.position = Vec3::new(-0.5, -0.5, -2.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse()
|
||||
* Quaternion::rotation_x(slow * 0.5)
|
||||
* Quaternion::rotation_y(tilt * 4.0 * slow + tilt * 3.0);
|
||||
}
|
||||
next.do_hold_lantern(s_a, anim_time, anim_time, speednorm, 0.0, tilt);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 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
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,10 @@ pub use self::{
|
||||
wallrun::WallrunAnimation, wield::WieldAnimation,
|
||||
};
|
||||
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};
|
||||
|
||||
pub type Body = comp::humanoid::Body;
|
||||
@ -333,3 +336,124 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CharacterSkeleton {
|
||||
/// Animate tools (main and secondary) on the character's back, taking in
|
||||
/// account backpack offsets.
|
||||
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);
|
||||
},
|
||||
_ => {},
|
||||
},
|
||||
(_, _) => {},
|
||||
}
|
||||
}
|
||||
|
||||
/// If we're holding a lantern, animate hold the lantern in a reasonable
|
||||
/// position.
|
||||
pub fn do_hold_lantern(
|
||||
&mut self,
|
||||
s_a: &SkeletonAttr,
|
||||
anim_time: f32,
|
||||
acc_vel: f32,
|
||||
speednorm: f32,
|
||||
impact: f32,
|
||||
tilt: f32,
|
||||
) {
|
||||
let lab = 2.0 / s_a.scaler;
|
||||
|
||||
let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.6 + PI * 0.5).sin()).powi(2))).sqrt())
|
||||
* ((acc_vel * lab * 1.6 + PI * 0.5).sin());
|
||||
|
||||
let shorte = ((1.0 / (0.8 + 0.2 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
|
||||
* ((acc_vel * lab * 1.6).sin());
|
||||
|
||||
self.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||
self.lantern.orientation =
|
||||
Quaternion::rotation_x(shorte * 0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
|
||||
self.lantern.scale = Vec3::one() * 0.65;
|
||||
self.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
if self.holding_lantern {
|
||||
self.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 + 1.0,
|
||||
s_a.hand.1 + 2.0 - impact * 0.2,
|
||||
s_a.hand.2 + 12.0 + impact * -0.1,
|
||||
);
|
||||
self.hand_r.orientation = Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9);
|
||||
self.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15 + 2.0);
|
||||
|
||||
let fast = (anim_time * 8.0).sin();
|
||||
let fast2 = (anim_time * 6.0 + 8.0).sin();
|
||||
|
||||
self.lantern.position = Vec3::new(-0.5, -0.5, -2.5);
|
||||
self.lantern.orientation = self.hand_r.orientation.inverse()
|
||||
* Quaternion::rotation_x(
|
||||
(fast + 0.5) * 1.0 * speednorm + (tilt.abs() * 2.0).min(PI * 0.5),
|
||||
)
|
||||
* Quaternion::rotation_y(tilt * 1.0 * fast + tilt * 1.0 + fast2 * speednorm * 0.25);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,84 +130,13 @@ impl Animation for MountAnimation {
|
||||
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 + 1.0 - head_look.x * 8.0,
|
||||
s_a.hand.1 + 5.0 + head_look.x * 6.0,
|
||||
s_a.hand.2 + 9.0 + head_look.y * 6.0,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.25)
|
||||
* Quaternion::rotation_z(0.9)
|
||||
* Quaternion::rotation_y(head_look.x * 3.0)
|
||||
* Quaternion::rotation_x(head_look.y * 3.0);
|
||||
|
||||
let fast = (anim_time * 5.0).sin();
|
||||
let fast2 = (anim_time * 4.5 + 8.0).sin();
|
||||
|
||||
next.lantern.position = Vec3::new(-0.5, -0.5, -2.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse()
|
||||
* Quaternion::rotation_x(fast * 0.1)
|
||||
* Quaternion::rotation_y(fast2 * 0.1);
|
||||
} else {
|
||||
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||
};
|
||||
next.do_hold_lantern(s_a, anim_time, 0.0, speed * 0.1 + 0.1, 0.0, tilt);
|
||||
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
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 {
|
||||
(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.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ impl Animation for RollAnimation {
|
||||
skeleton: &Self::Skeleton,
|
||||
(
|
||||
active_tool_kind,
|
||||
_second_tool_kind,
|
||||
second_tool_kind,
|
||||
hands,
|
||||
wield_status,
|
||||
orientation,
|
||||
@ -206,46 +206,20 @@ impl Animation for RollAnimation {
|
||||
(_, _) => {},
|
||||
}
|
||||
} else {
|
||||
next.hand_l.position = Vec3::new(
|
||||
-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.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||
}
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.head.0 + 1.5 * movement1,
|
||||
s_a.head.1 - 1.0 * movement1,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.3 * movement1)
|
||||
* if prev_aimed_dir.is_some() {
|
||||
Quaternion::identity()
|
||||
} else {
|
||||
Quaternion::rotation_y(-0.4)
|
||||
};
|
||||
next.head.orientation = if prev_aimed_dir.is_some() {
|
||||
Quaternion::identity()
|
||||
} else {
|
||||
Quaternion::rotation_x(-0.3 * movement1) * Quaternion::rotation_y(-0.4)
|
||||
};
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, -9.5 * movement1 + s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_x(-0.2 * movement1);
|
||||
|
||||
next.belt.position = Vec3::new(
|
||||
0.0,
|
||||
@ -254,37 +228,76 @@ impl Animation for RollAnimation {
|
||||
);
|
||||
next.belt.orientation = Quaternion::rotation_x(0.55 * movement1);
|
||||
|
||||
next.shorts.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.shorts.0 + 4.5 * movement1,
|
||||
s_a.shorts.1 + 2.5 * movement1,
|
||||
);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.8 * movement1);
|
||||
if let Some(prev_aimed_dir) = prev_aimed_dir {
|
||||
let forward = prev_aimed_dir.dot(orientation.into()).abs();
|
||||
let sideways = 1.0 - forward;
|
||||
|
||||
next.foot_l.position = Vec3::new(
|
||||
if prev_aimed_dir.is_some() {
|
||||
1.0 * movement1 - s_a.foot.0
|
||||
} else {
|
||||
1.0 * movement1 - s_a.foot.0 + 5.0
|
||||
},
|
||||
s_a.foot.1 + 5.5 * movement1,
|
||||
s_a.foot.2 - 5.0 * movement1,
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(0.9 * movement1);
|
||||
if matches!(hands.0, None | Some(Hands::One)) {
|
||||
next.hand_l.position += Vec3::new(-2.0, -8.0, 6.0);
|
||||
next.hand_l.orientation =
|
||||
next.hand_l.orientation * Quaternion::rotation_z(PI * -0.25);
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
if prev_aimed_dir.is_some() {
|
||||
1.0 * movement1 + s_a.foot.0
|
||||
} else {
|
||||
1.0 * movement1 + s_a.foot.0 + 3.0
|
||||
},
|
||||
s_a.foot.1 + 5.5 * movement1,
|
||||
s_a.foot.2 - 5.0 * movement1,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(0.9 * movement1);
|
||||
next.main.position += Vec3::new(-2.0, -6.0, 8.0);
|
||||
next.main.orientation = next.main.orientation * Quaternion::rotation_x(PI * 0.6);
|
||||
}
|
||||
|
||||
if matches!(hands.1, None | Some(Hands::One)) {
|
||||
next.hand_r.position += Vec3::new(2.0, -6.0, 6.0);
|
||||
next.hand_r.orientation =
|
||||
next.hand_r.orientation * Quaternion::rotation_z(PI * 0.25);
|
||||
|
||||
next.second.position += Vec3::new(2.0, -8.0, 8.0);
|
||||
next.second.orientation =
|
||||
next.second.orientation * Quaternion::rotation_x(PI * 0.6);
|
||||
}
|
||||
|
||||
next.shorts.position =
|
||||
Vec3::new(0.0, s_a.shorts.0 + 0.5 * movement1, s_a.shorts.1 - 1.0);
|
||||
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.0 * movement1);
|
||||
|
||||
next.foot_l.position = Vec3::new(
|
||||
1.0 * movement1 - s_a.foot.0 - 4.0 * sideways,
|
||||
s_a.foot.1 + 5.5 * movement1 * forward,
|
||||
s_a.foot.2 - 5.0 * movement1 - 5.0,
|
||||
);
|
||||
next.foot_l.orientation =
|
||||
Quaternion::rotation_x(0.5 * forward) * Quaternion::rotation_y(0.8 * sideways);
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
1.0 * movement1 + s_a.foot.0 + 4.0 * sideways,
|
||||
s_a.foot.1 - (5.5 * movement1 + 4.0) * forward,
|
||||
s_a.foot.2 - 5.0 * movement1 - 3.0,
|
||||
);
|
||||
next.foot_r.orientation =
|
||||
Quaternion::rotation_x(1.5 * forward) * Quaternion::rotation_y(-0.8 * sideways);
|
||||
} else {
|
||||
next.chest.orientation = Quaternion::rotation_x(-0.2 * movement1);
|
||||
|
||||
next.shorts.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.shorts.0 + 4.5 * movement1,
|
||||
s_a.shorts.1 + 2.5 * movement1,
|
||||
);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.8 * movement1);
|
||||
|
||||
next.foot_l.position = Vec3::new(
|
||||
1.0 * movement1 - s_a.foot.0 + 5.0,
|
||||
s_a.foot.1 + 5.5 * movement1,
|
||||
s_a.foot.2 - 5.0 * movement1,
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(0.9 * movement1);
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
1.0 * movement1 + s_a.foot.0 + 3.0,
|
||||
s_a.foot.1 + 5.5 * movement1,
|
||||
s_a.foot.2 - 5.0 * movement1,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(0.9 * movement1);
|
||||
}
|
||||
|
||||
next.torso.position = if prev_aimed_dir.is_some() {
|
||||
Vec3::new(0.0, 0.0, 7.0 * movement1)
|
||||
Vec3::new(0.0, 0.0, 4.0 + 7.0 * movement1)
|
||||
} else {
|
||||
Vec3::new(4.0, 0.0, 7.0 * movement1)
|
||||
};
|
||||
|
@ -67,9 +67,6 @@ impl Animation for RunAnimation {
|
||||
let noisea = (acc_vel * 11.0 + PI / 6.0).sin();
|
||||
let noiseb = (acc_vel * 19.0 + PI / 4.0).sin();
|
||||
|
||||
let shorte = ((1.0 / (0.8 + 0.2 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
|
||||
* ((acc_vel * lab * 1.6).sin());
|
||||
|
||||
let back_speed = 2.6;
|
||||
|
||||
let dirside = orientation.xy().dot(velocity.xy()).signum();
|
||||
@ -131,9 +128,9 @@ impl Animation for RunAnimation {
|
||||
(global_time + anim_time / 18.0).floor().mul(1337.0).sin() * 0.1,
|
||||
);
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + short * 0.1);
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 * 1.5, s_a.head.1 + short * 0.1);
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 + short * -0.3)
|
||||
Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 + short * -0.3 * speednorm)
|
||||
* Quaternion::rotation_x(head_look.y + 0.45 * speednorm + shortalt2 * -0.05);
|
||||
next.head.scale = Vec3::one() * s_a.head_scale;
|
||||
|
||||
@ -143,8 +140,8 @@ impl Animation for RunAnimation {
|
||||
s_a.chest.1 + 1.0 * speednorm + shortalt * 1.1,
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_x(impact * 0.07)
|
||||
* Quaternion::rotation_z(short * 0.4 + tilt * -0.6)
|
||||
* Quaternion::rotation_y(tilt * 2.0 + short * 0.2)
|
||||
* Quaternion::rotation_z(short * 0.4 * speednorm + tilt * -0.6)
|
||||
* Quaternion::rotation_y(tilt * 2.0 + short * 0.2 * speednorm)
|
||||
* Quaternion::rotation_x(shortalt2 * 0.03 + speednorm * -0.5 + tilt.abs());
|
||||
|
||||
next.belt.position = Vec3::new(0.0, 0.25 + s_a.belt.0, 0.25 + s_a.belt.1);
|
||||
@ -159,14 +156,14 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, 0.65 + s_a.shorts.0, 0.65 * speednorm + s_a.shorts.1);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.2 * speednorm)
|
||||
* Quaternion::rotation_z(short * -0.9 + tilt * -1.5)
|
||||
* Quaternion::rotation_z(short * -0.9 * speednorm + tilt * -1.5)
|
||||
* Quaternion::rotation_y(tilt * 0.7 + short * 0.08);
|
||||
|
||||
next.hand_l.position = Vec3::new(
|
||||
-s_a.hand.0 * 1.2 - foothorir * 1.3 * speednorm
|
||||
+ (foothoril.abs().powf(2.0) - 0.5) * speednorm * 4.0,
|
||||
s_a.hand.1 * 1.3 + foothorir * -7.0 * speednorm * (1.0 - sideabs),
|
||||
s_a.hand.2 - foothorir * 2.75 * speednorm + foothoril.abs().powf(3.0) * speednorm * 8.0,
|
||||
+ (foothoril.abs().powi(2) - 0.5) * speednorm * 4.0,
|
||||
s_a.hand.1 * 1.3 + foothorir * -7.0 * speednorm.powi(2) * (1.0 - sideabs),
|
||||
s_a.hand.2 - foothorir * 2.75 * speednorm + foothoril.abs().powi(3) * speednorm * 8.0,
|
||||
);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(
|
||||
@ -175,9 +172,9 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 * 1.2 + foothoril * 1.3 * speednorm
|
||||
- (foothorir.abs().powf(2.0) - 0.5) * speednorm * 4.0,
|
||||
s_a.hand.1 * 1.3 + foothoril * -7.0 * speednorm * (1.0 - sideabs),
|
||||
s_a.hand.2 - foothoril * 2.75 * speednorm + foothorir.abs().powf(3.0) * speednorm * 8.0,
|
||||
- (foothorir.abs().powi(2) - 0.5) * speednorm * 4.0,
|
||||
s_a.hand.1 * 1.3 + foothoril * -7.0 * speednorm.powi(2) * (1.0 - sideabs),
|
||||
s_a.hand.2 - foothoril * 2.75 * speednorm + foothorir.abs().powi(3) * speednorm * 8.0,
|
||||
);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(
|
||||
@ -186,160 +183,55 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0 + footstrafel * sideabs * 7.0 + tilt * -10.0,
|
||||
s_a.foot.1 + (1.0 - sideabs) * (-0.5 * speednorm + foothoril * -10.5 * speednorm),
|
||||
s_a.foot.1 + (1.0 - sideabs) * (-1.5 * speednorm + foothoril * -10.0 * speednorm),
|
||||
s_a.foot.2
|
||||
+ (1.0 - sideabs) * (1.25 * speednorm + ((footvertl * -5.0 * speednorm).max(-1.0)))
|
||||
+ (1.0 - sideabs) * (1.25 + (footvertl * -5.0).max(-1.0)) * speednorm
|
||||
+ side * ((footvertsl * 1.5).max(-1.0)),
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(
|
||||
(1.0 - sideabs) * (foothoril + 0.4 * (1.0 - sideabs)) * -1.5 * speednorm
|
||||
(1.0 - sideabs) * (foothoril + 0.3 * (1.0 - sideabs)) * -1.5 * speednorm
|
||||
+ sideabs * -0.5,
|
||||
) * Quaternion::rotation_y(
|
||||
tilt * -0.5 + side * 0.3 + side * (foothoril * 0.3),
|
||||
tilt * -0.5 + side * (foothoril * 0.3) + footstrafer * side * 0.5,
|
||||
) * Quaternion::rotation_z(
|
||||
side * 0.9 * orientation.xy().dot(velocity.xy() / (speed + 0.01)),
|
||||
side * 1.3 * orientation.xy().dot(velocity.xy() / (speed + 0.01)),
|
||||
);
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0 + footstrafer * sideabs * 7.0 + tilt * -10.0,
|
||||
s_a.foot.1 + (1.0 - sideabs) * (-0.5 * speednorm + foothorir * -10.5 * speednorm),
|
||||
s_a.foot.1 + (1.0 - sideabs) * (-1.5 * speednorm + foothorir * -10.0 * speednorm),
|
||||
s_a.foot.2
|
||||
+ (1.0 - sideabs) * (1.25 * speednorm + ((footvertr * -5.0 * speednorm).max(-1.0)))
|
||||
+ (1.0 - sideabs) * (1.25 + (footvertr * -5.0).max(-1.0)) * speednorm
|
||||
+ side * ((footvertsr * -1.5).max(-1.0)),
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(
|
||||
(1.0 - sideabs) * (foothorir + 0.4 * (1.0 - sideabs)) * -1.5 * speednorm
|
||||
(1.0 - sideabs) * (foothorir + 0.3 * (1.0 - sideabs)) * -1.5 * speednorm
|
||||
+ sideabs * -0.5,
|
||||
) * Quaternion::rotation_y(
|
||||
tilt * -0.5 + side * 0.3 + side * (foothorir * 0.3),
|
||||
tilt * -0.5 + side * (foothorir * 0.3) - footstrafer * side * 0.5,
|
||||
) * Quaternion::rotation_z(
|
||||
side * 0.9 * orientation.xy().dot(velocity.xy() / (speed + 0.01)),
|
||||
side * 1.3 * orientation.xy().dot(velocity.xy() / (speed + 0.01)),
|
||||
);
|
||||
//
|
||||
|
||||
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_l.orientation =
|
||||
Quaternion::rotation_x(short * 0.15 + (footrotl * 1.2 + 0.5) * speednorm);
|
||||
Quaternion::rotation_x(short * 0.15 * speednorm + (footrotl * 0.5 + 0.5) * speednorm);
|
||||
next.shoulder_l.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_r.orientation =
|
||||
Quaternion::rotation_x(short * -0.15 + (footrotr * 1.2 + 0.5) * speednorm);
|
||||
Quaternion::rotation_x(short * -0.15 * speednorm + (footrotr * 0.5 + 0.5) * speednorm);
|
||||
next.shoulder_r.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
|
||||
let main_tool = if let (None, Some(Hands::Two)) = hands {
|
||||
second_tool_kind
|
||||
} else {
|
||||
active_tool_kind
|
||||
};
|
||||
next.do_tools_on_back(hands, active_tool_kind, second_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.orientation =
|
||||
Quaternion::rotation_x(shorte * 0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 + 1.0,
|
||||
s_a.hand.1 + 2.0 - impact * 0.2,
|
||||
s_a.hand.2 + 12.0 + impact * -0.1,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9);
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15 + 2.0);
|
||||
|
||||
let fast = (anim_time * 8.0).sin();
|
||||
let fast2 = (anim_time * 6.0 + 8.0).sin();
|
||||
|
||||
next.lantern.position = Vec3::new(-0.5, -0.5, -2.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse()
|
||||
* Quaternion::rotation_x((fast + 0.5) * 1.0 * speednorm)
|
||||
* Quaternion::rotation_y(tilt * 4.0 * fast + tilt * 3.0 + fast2 * speednorm * 0.25);
|
||||
}
|
||||
next.do_hold_lantern(s_a, anim_time, acc_vel, speednorm, impact, tilt);
|
||||
|
||||
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) {
|
||||
let push = (1.0 - orientation.x.abs()).powi(2);
|
||||
let right_sub = -(orientation.x).min(0.0);
|
||||
|
@ -89,25 +89,7 @@ impl Animation for SitAnimation {
|
||||
|
||||
next.torso.position = Vec3::new(0.0, -2.2, stop * -1.76);
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 + 1.0 - head_look.x * 8.0,
|
||||
s_a.hand.1 + 5.0 + head_look.x * 6.0,
|
||||
s_a.hand.2 + 9.0 + head_look.y * 6.0,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.25)
|
||||
* Quaternion::rotation_z(0.9)
|
||||
* Quaternion::rotation_y(head_look.x * 3.0)
|
||||
* Quaternion::rotation_x(head_look.y * 3.0);
|
||||
|
||||
let fast = (anim_time * 5.0).sin();
|
||||
let fast2 = (anim_time * 4.5 + 8.0).sin();
|
||||
|
||||
next.lantern.position = Vec3::new(-0.5, -0.5, -2.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse()
|
||||
* Quaternion::rotation_x(fast * 0.1)
|
||||
* Quaternion::rotation_y(fast2 * 0.1);
|
||||
}
|
||||
next.do_hold_lantern(s_a, anim_time, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -159,13 +159,7 @@ impl Animation for SneakAnimation {
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, 4.0 + s_a.foot.1, s_a.foot.2);
|
||||
}
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1 + 5.0, s_a.hand.2 + 9.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.5);
|
||||
|
||||
next.lantern.position = Vec3::new(0.0, 1.5, -5.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse();
|
||||
}
|
||||
next.do_hold_lantern(s_a, anim_time, anim_time, speed / 10.0, 0.0, tilt);
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -66,9 +66,6 @@ impl Animation for SneakWieldAnimation {
|
||||
let noisea = (anim_time * 11.0 + PI / 6.0).sin();
|
||||
let noiseb = (anim_time * 19.0 + PI / 4.0).sin();
|
||||
|
||||
let shorte = ((5.0 / (4.0 + 1.0 * ((anim_time * lab * 7.0).sin()).powi(2))).sqrt())
|
||||
* ((anim_time * lab * 7.0).sin());
|
||||
|
||||
let shortalt = (anim_time * lab * 7.0 + PI / 2.0).sin();
|
||||
|
||||
let head_look = Vec2::new(
|
||||
@ -145,9 +142,6 @@ impl Animation for SneakWieldAnimation {
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(short * 0.15 * walkintensity);
|
||||
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15 * walkintensity);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(shorte * 0.2 + 0.4) * Quaternion::rotation_y(shorte * 0.1);
|
||||
} else {
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
@ -178,14 +172,6 @@ impl Animation for SneakWieldAnimation {
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, 4.0 + s_a.foot.1, s_a.foot.2);
|
||||
}
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1 + 5.0, s_a.hand.2 + 9.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.5);
|
||||
|
||||
next.lantern.position = Vec3::new(0.0, 1.5, -5.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse();
|
||||
}
|
||||
|
||||
match (hands, active_tool_kind, second_tool_kind) {
|
||||
((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => match tool {
|
||||
Some(ToolKind::Sword) => {
|
||||
@ -374,27 +360,8 @@ impl Animation for SneakWieldAnimation {
|
||||
next.second = next.main;
|
||||
}
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 - head_look.x * 6.0,
|
||||
s_a.hand.1 + 5.0 - head_look.y * 10.0 + slow * 0.15,
|
||||
s_a.hand.2 + 12.0 + head_look.y * 6.0 + slow * 0.5,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.25 + slow * -0.06)
|
||||
* Quaternion::rotation_z(0.9)
|
||||
* Quaternion::rotation_y(head_look.x * 1.5)
|
||||
* Quaternion::rotation_x(head_look.y * 1.5);
|
||||
next.do_hold_lantern(s_a, anim_time, anim_time, speednorm, 0.0, tilt);
|
||||
|
||||
let fast = (anim_time * 8.0).sin();
|
||||
let fast2 = (anim_time * 6.0 + 8.0).sin();
|
||||
|
||||
next.lantern.position = Vec3::new(-0.5, -0.5, -2.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse()
|
||||
* Quaternion::rotation_x((fast + 0.5) * 1.0 * speednorm + fast * 0.1)
|
||||
* Quaternion::rotation_y(
|
||||
tilt * 1.0 * fast + tilt * 1.0 + fast2 * speednorm * 0.25 + fast2 * 0.1,
|
||||
);
|
||||
}
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ use super::{
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use core::f32::consts::PI;
|
||||
use std::ops::Mul;
|
||||
|
||||
pub struct StandAnimation;
|
||||
@ -108,93 +107,10 @@ impl Animation for StandAnimation {
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
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 {
|
||||
(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.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||
|
||||
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);
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 - head_look.x * 10.0,
|
||||
s_a.hand.1 + 5.0 - head_look.y * 8.0 + slow * 0.15 - impact * 0.2,
|
||||
s_a.hand.2 + 12.0 + slow * 0.5 + impact * -0.1,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.5 + slow * -0.06 + impact * -0.1)
|
||||
* Quaternion::rotation_z(0.9)
|
||||
* Quaternion::rotation_y(head_look.x * 1.5)
|
||||
* Quaternion::rotation_x(head_look.y * 1.5);
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(slow * 0.15 + 2.0);
|
||||
|
||||
let fast = (anim_time * 5.0).sin();
|
||||
let fast2 = (anim_time * 4.5 + 8.0).sin();
|
||||
|
||||
next.lantern.position = Vec3::new(-0.5, -0.5, -2.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse()
|
||||
* Quaternion::rotation_x(fast * 0.1)
|
||||
* Quaternion::rotation_y(fast2 * 0.1 + tilt * 3.0);
|
||||
}
|
||||
next.do_hold_lantern(s_a, anim_time, 0.0, 0.0, impact, tilt);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.scale = Vec3::one();
|
||||
|
@ -171,57 +171,7 @@ impl Animation for SwimAnimation {
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
|
||||
let main_tool = if let (None, Some(Hands::Two)) = hands {
|
||||
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.do_tools_on_back(hands, active_tool_kind, second_tool_kind);
|
||||
|
||||
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
@ -238,37 +188,6 @@ impl Animation for SwimAnimation {
|
||||
+ avgspeed * avg_vel.z * -0.003,
|
||||
) * Quaternion::rotation_y(tilt * 2.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
|
||||
}
|
||||
|
@ -2,14 +2,21 @@ use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::comp::item::{AbilitySpec, Hands, ToolKind};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct WallrunAnimation;
|
||||
|
||||
type WallrunAnimationDependency = (Vec3<f32>, f32, Option<Vec3<f32>>);
|
||||
|
||||
impl Animation for WallrunAnimation {
|
||||
type Dependency<'a> = WallrunAnimationDependency;
|
||||
type Dependency<'a> = (
|
||||
(Option<ToolKind>, Option<&'a AbilitySpec>),
|
||||
Option<ToolKind>,
|
||||
(Option<Hands>, Option<Hands>),
|
||||
Vec3<f32>,
|
||||
f32,
|
||||
Option<Vec3<f32>>,
|
||||
bool,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -19,7 +26,15 @@ impl Animation for WallrunAnimation {
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(orientation, acc_vel, wall): Self::Dependency<'_>,
|
||||
(
|
||||
(active_tool_kind, active_tool_spec),
|
||||
second_tool_kind,
|
||||
hands,
|
||||
orientation,
|
||||
acc_vel,
|
||||
wall,
|
||||
was_wielded,
|
||||
): Self::Dependency<'_>,
|
||||
_anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -185,6 +200,173 @@ impl Animation for WallrunAnimation {
|
||||
* Quaternion::rotation_x(-0.1);
|
||||
};
|
||||
|
||||
if was_wielded {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.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);
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
match (hands, active_tool_kind, second_tool_kind) {
|
||||
((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => {
|
||||
match tool {
|
||||
Some(ToolKind::Sword) => {
|
||||
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.shl.3)
|
||||
* Quaternion::rotation_y(s_a.shl.4);
|
||||
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.shr.3)
|
||||
* Quaternion::rotation_y(s_a.shr.4);
|
||||
|
||||
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1 - 3.0, s_a.sc.2);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(0.0);
|
||||
},
|
||||
Some(ToolKind::Axe) => {
|
||||
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.ahl.0, s_a.ahl.1, s_a.ahl.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3)
|
||||
* Quaternion::rotation_y(s_a.ahl.4);
|
||||
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.ahr.3)
|
||||
* Quaternion::rotation_z(s_a.ahr.5);
|
||||
|
||||
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 | ToolKind::Pick | ToolKind::Shovel) => {
|
||||
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3)
|
||||
* Quaternion::rotation_y(s_a.hhl.4)
|
||||
* Quaternion::rotation_z(s_a.hhl.5);
|
||||
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3)
|
||||
* Quaternion::rotation_y(s_a.hhr.4)
|
||||
* Quaternion::rotation_z(s_a.hhr.5);
|
||||
|
||||
next.control.position = Vec3::new(s_a.hc.0, s_a.hc.1, s_a.hc.2 + 6.0);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.hc.3)
|
||||
* Quaternion::rotation_y(s_a.hc.4)
|
||||
* Quaternion::rotation_z(s_a.hc.5);
|
||||
},
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.sthr.3)
|
||||
* Quaternion::rotation_y(s_a.sthr.4);
|
||||
|
||||
next.control.position =
|
||||
Vec3::new(s_a.stc.0, s_a.stc.1 - 2.0, s_a.stc.2 + 4.0);
|
||||
|
||||
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);
|
||||
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.stc.3)
|
||||
* Quaternion::rotation_y(s_a.stc.4)
|
||||
* Quaternion::rotation_z(s_a.stc.5);
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
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.0, -1.0, -5.2);
|
||||
next.hold.orientation = Quaternion::rotation_x(-PI / 2.0);
|
||||
next.hold.scale = Vec3::one() * 1.0;
|
||||
|
||||
next.control.position =
|
||||
Vec3::new(s_a.bc.0 + 2.0, s_a.bc.1, s_a.bc.2 + 5.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.8)
|
||||
* Quaternion::rotation_y(s_a.bc.4)
|
||||
* Quaternion::rotation_z(s_a.bc.5);
|
||||
},
|
||||
Some(ToolKind::Instrument) => {
|
||||
if let Some(AbilitySpec::Custom(spec)) = active_tool_spec {
|
||||
match spec.as_str() {
|
||||
"Washboard" => {
|
||||
next.hand_l.position = Vec3::new(-7.0, 0.0, 3.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
||||
next.main.position = Vec3::new(-5.0, -4.5, -5.0);
|
||||
next.main.orientation = Quaternion::rotation_x(5.5);
|
||||
},
|
||||
_ => {
|
||||
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
||||
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
|
||||
next.main.orientation = Quaternion::rotation_x(PI);
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
Some(ToolKind::Debug) => {
|
||||
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
||||
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
|
||||
next.main.orientation = Quaternion::rotation_x(PI);
|
||||
},
|
||||
Some(ToolKind::Farming) => {
|
||||
next.head.orientation = Quaternion::rotation_x(-0.2);
|
||||
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
next.main.position = Vec3::new(7.5, 7.5, 13.2);
|
||||
next.main.orientation = Quaternion::rotation_y(PI);
|
||||
|
||||
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(0.6)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
((_, _), _, _) => {},
|
||||
};
|
||||
match hands {
|
||||
(Some(Hands::One), _) => {
|
||||
next.control_l.position = Vec3::new(-7.0, 6.0, 5.0);
|
||||
next.control_l.orientation =
|
||||
Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.2);
|
||||
next.hand_l.position = Vec3::new(-1.0, -0.5, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
match hands {
|
||||
(None | Some(Hands::One), Some(Hands::One)) => {
|
||||
next.control_r.position = Vec3::new(7.0, 6.0, 5.0);
|
||||
next.control_r.orientation =
|
||||
Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(-0.2);
|
||||
next.hand_r.position = Vec3::new(1.0, -0.5, 0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
match hands {
|
||||
(None, None) | (None, Some(Hands::One)) => {
|
||||
next.hand_l.position = Vec3::new(-8.0, 2.0, 1.0);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(0.5) * Quaternion::rotation_y(0.25);
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
match hands {
|
||||
(None, None) | (Some(Hands::One), None) => {
|
||||
next.hand_r.position = Vec3::new(8.0, 2.0, 1.0);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(0.5) * Quaternion::rotation_y(-0.25);
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -551,27 +551,7 @@ impl Animation for WieldAnimation {
|
||||
next.second = next.main;
|
||||
}
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 - head_look.x * 6.0,
|
||||
s_a.hand.1 + 5.0 - head_look.y * 10.0 + slow * 0.15,
|
||||
s_a.hand.2 + 12.0 + head_look.y * 6.0 + slow * 0.5,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.25 + slow * -0.06)
|
||||
* Quaternion::rotation_z(0.9)
|
||||
* Quaternion::rotation_y(head_look.x * 1.5)
|
||||
* Quaternion::rotation_x(head_look.y * 1.5);
|
||||
|
||||
let fast = (anim_time * 8.0).sin();
|
||||
let fast2 = (anim_time * 6.0 + 8.0).sin();
|
||||
|
||||
next.lantern.position = Vec3::new(-0.5, -0.5, -2.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse()
|
||||
* Quaternion::rotation_x((fast + 0.5) * 1.0 * speednorm + fast * 0.1)
|
||||
* Quaternion::rotation_y(
|
||||
tilt * 1.0 * fast + tilt * 1.0 + fast2 * speednorm * 0.25 + fast2 * 0.1,
|
||||
);
|
||||
}
|
||||
next.do_hold_lantern(s_a, anim_time, anim_time, speednorm, 0.0, tilt);
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -2060,13 +2060,17 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::Wallrun { .. } => {
|
||||
CharacterState::Wallrun(data) => {
|
||||
anim::character::WallrunAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
(active_tool_kind, active_tool_spec),
|
||||
second_tool_kind,
|
||||
hands,
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.acc_vel,
|
||||
wall_dir,
|
||||
data.was_wielded,
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
|
Loading…
Reference in New Issue
Block a user