mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
orientation animation
This commit is contained in:
parent
6789a95557
commit
ea07d744a7
@ -11,11 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Added context-sensitive crosshair
|
||||
- Announce alias changes to all clients.
|
||||
- Dance animation
|
||||
|
||||
### Changed
|
||||
|
||||
- Improved camera aiming
|
||||
- Made civsim, sites, etc. deterministic from the same seed.
|
||||
- Improved animations by adding orientation variation
|
||||
|
||||
### Removed
|
||||
|
||||
|
@ -1,47 +1,47 @@
|
||||
((
|
||||
default: (
|
||||
vox_spec: ("armor.foot.foot_none", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.foot_none", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
map: {
|
||||
Dark: (
|
||||
vox_spec: ("armor.foot.dark-0", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.dark-0", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
Assassin: (
|
||||
vox_spec: ("armor.foot.assa", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.assa", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
Jester: (
|
||||
vox_spec: ("armor.foot.dark_jester-elf_shoe", (-2.5, -3.0, -9.0)),
|
||||
vox_spec: ("armor.foot.dark_jester-elf_shoe", (-2.5, -3.0, -2.0)),
|
||||
color: None
|
||||
),
|
||||
Plate0: (
|
||||
vox_spec: ("armor.foot.plate-0", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.plate-0", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
Leather0: (
|
||||
vox_spec: ("armor.foot.leather-0", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.leather-0", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
ClothPurple0:(
|
||||
vox_spec: ("armor.foot.cloth_purple-0", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.cloth_purple-0", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
ClothBlue0:(
|
||||
vox_spec: ("armor.foot.cloth_blue-0", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.cloth_blue-0", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
ClothGreen0:(
|
||||
vox_spec: ("armor.foot.cloth_green-0", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.cloth_green-0", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
Sandal0:(
|
||||
vox_spec: ("armor.foot.cloth_sandals", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.cloth_sandals", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
Cultist: (
|
||||
vox_spec: ("armor.foot.cultist", (-2.5, -3.5, -9.0)),
|
||||
vox_spec: ("armor.foot.cultist", (-2.5, -3.5, -2.0)),
|
||||
color: None
|
||||
),
|
||||
Steel0:(
|
||||
|
@ -1,122 +1,122 @@
|
||||
((
|
||||
default: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.hand_right_none", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.hand_right_none", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.hand_right_none", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.hand_right_none", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
map: {
|
||||
Assassin: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.assa_right", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.assa_right", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.assa_right", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.assa_right", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
Cloth: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.cloth_basic_right", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cloth_basic_right", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.cloth_basic_right", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cloth_basic_right", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
Plate0: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.plate_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.plate_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.plate_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.plate_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
Leather0: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.leather_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.leather_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.leather_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.leather_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
ClothPurple0: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.cloth_purple_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cloth_purple_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.cloth_purple_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cloth_purple_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
ClothBlue0: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.cloth_blue_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cloth_blue_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.cloth_blue_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cloth_blue_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
ClothGreen0: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.cloth_green_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cloth_green_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.cloth_green_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cloth_green_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
CultistPurple: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.cultist_right", (-3.0, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cultist_right", (-3.0, -1.5, -2.5)),
|
||||
color: Some((30, 0, 64))
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.cultist_right", (-2.0, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cultist_right", (-2.0, -1.5, -2.5)),
|
||||
color: Some((30, 0, 64))
|
||||
)
|
||||
),
|
||||
CultistBlue: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.cultist_right", (-3.0, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cultist_right", (-3.0, -1.5, -2.5)),
|
||||
color: Some((57, 81, 132))
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.cultist_right", (-2.0, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.cultist_right", (-2.0, -1.5, -2.5)),
|
||||
color: Some((57, 81, 132))
|
||||
)
|
||||
),
|
||||
Steel0: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.steel_left-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.steel_left-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.steel_right-0", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.steel_right-0", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
Leather2: (
|
||||
left: (
|
||||
vox_spec: ("armor.hand.leather_left-2", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.leather_left-2", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
),
|
||||
right: (
|
||||
vox_spec: ("armor.hand.leather_right-2", (-1.5, -1.5, -7.0)),
|
||||
vox_spec: ("armor.hand.leather_right-2", (-1.5, -1.5, -2.5)),
|
||||
color: None
|
||||
)
|
||||
),
|
||||
|
@ -398,6 +398,21 @@ impl Client {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn toggle_dance(&mut self) {
|
||||
let is_dancing = self
|
||||
.state
|
||||
.ecs()
|
||||
.read_storage::<comp::CharacterState>()
|
||||
.get(self.entity)
|
||||
.map(|cs| matches!(cs, comp::CharacterState::Dance));
|
||||
|
||||
match is_dancing {
|
||||
Some(true) => self.control_action(ControlAction::Stand),
|
||||
Some(false) => self.control_action(ControlAction::Dance),
|
||||
None => warn!("Can't toggle dance, client entity doesn't have a `CharacterState`"),
|
||||
}
|
||||
}
|
||||
|
||||
fn control_action(&mut self, control_action: ControlAction) {
|
||||
if let Some(controller) = self
|
||||
.state
|
||||
|
@ -39,6 +39,7 @@ pub enum CharacterState {
|
||||
Idle,
|
||||
Climb,
|
||||
Sit,
|
||||
Dance,
|
||||
Glide,
|
||||
/// A basic blocking state
|
||||
BasicBlock,
|
||||
|
@ -31,6 +31,7 @@ pub enum ControlAction {
|
||||
Wield,
|
||||
Unwield,
|
||||
Sit,
|
||||
Dance,
|
||||
Stand,
|
||||
}
|
||||
|
||||
|
42
common/src/states/dance.rs
Normal file
42
common/src/states/dance.rs
Normal file
@ -0,0 +1,42 @@
|
||||
use super::utils::*;
|
||||
use crate::{
|
||||
comp::{CharacterState, StateUpdate},
|
||||
sys::character_behavior::{CharacterBehavior, JoinData},
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
|
||||
pub struct Data;
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_primary_wield(data, &mut update);
|
||||
|
||||
// Try to Fall/Stand up/Move
|
||||
if !data.physics.on_ground || data.inputs.move_dir.magnitude_squared() > 0.0 {
|
||||
update.character = CharacterState::Idle;
|
||||
}
|
||||
|
||||
update
|
||||
}
|
||||
|
||||
fn wield(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
attempt_wield(data, &mut update);
|
||||
update
|
||||
}
|
||||
|
||||
fn sit(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
attempt_sit(data, &mut update);
|
||||
update
|
||||
}
|
||||
|
||||
fn stand(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
// Try to Fall/Stand up/Move
|
||||
update.character = CharacterState::Idle;
|
||||
update
|
||||
}
|
||||
}
|
@ -32,6 +32,12 @@ impl CharacterBehavior for Data {
|
||||
update
|
||||
}
|
||||
|
||||
fn dance(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
attempt_dance(data, &mut update);
|
||||
update
|
||||
}
|
||||
|
||||
fn swap_loadout(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
attempt_swap_loadout(data, &mut update);
|
||||
|
@ -3,6 +3,7 @@ pub mod basic_melee;
|
||||
pub mod basic_ranged;
|
||||
pub mod boost;
|
||||
pub mod climb;
|
||||
pub mod dance;
|
||||
pub mod dash_melee;
|
||||
pub mod equipping;
|
||||
pub mod glide;
|
||||
|
@ -27,6 +27,12 @@ impl CharacterBehavior for Data {
|
||||
update
|
||||
}
|
||||
|
||||
fn dance(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
attempt_dance(data, &mut update);
|
||||
update
|
||||
}
|
||||
|
||||
fn stand(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
// Try to Fall/Stand up/Move
|
||||
|
@ -121,6 +121,12 @@ pub fn attempt_sit(data: &JoinData, update: &mut StateUpdate) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn attempt_dance(data: &JoinData, update: &mut StateUpdate) {
|
||||
if data.physics.on_ground && data.body.is_humanoid() {
|
||||
update.character = CharacterState::Dance;
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks that player can `Climb` and updates `CharacterState` if so
|
||||
pub fn handle_climb(data: &JoinData, update: &mut StateUpdate) {
|
||||
if data.inputs.climb.is_some()
|
||||
|
@ -28,6 +28,12 @@ impl CharacterBehavior for Data {
|
||||
update
|
||||
}
|
||||
|
||||
fn dance(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
attempt_dance(data, &mut update);
|
||||
update
|
||||
}
|
||||
|
||||
fn unwield(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
update.character = CharacterState::Idle;
|
||||
|
@ -20,6 +20,7 @@ pub trait CharacterBehavior {
|
||||
fn wield(&self, data: &JoinData) -> StateUpdate { StateUpdate::from(data) }
|
||||
fn unwield(&self, data: &JoinData) -> StateUpdate { StateUpdate::from(data) }
|
||||
fn sit(&self, data: &JoinData) -> StateUpdate { StateUpdate::from(data) }
|
||||
fn dance(&self, data: &JoinData) -> StateUpdate { StateUpdate::from(data) }
|
||||
fn stand(&self, data: &JoinData) -> StateUpdate { StateUpdate::from(data) }
|
||||
fn handle_event(&self, data: &JoinData, event: ControlAction) -> StateUpdate {
|
||||
match event {
|
||||
@ -27,6 +28,7 @@ pub trait CharacterBehavior {
|
||||
ControlAction::Wield => self.wield(data),
|
||||
ControlAction::Unwield => self.unwield(data),
|
||||
ControlAction::Sit => self.sit(data),
|
||||
ControlAction::Dance => self.dance(data),
|
||||
ControlAction::Stand => self.stand(data),
|
||||
}
|
||||
}
|
||||
@ -196,6 +198,9 @@ impl<'a> System<'a> for Sys {
|
||||
CharacterState::Sit => {
|
||||
states::sit::Data::handle_event(&states::sit::Data, &j, action)
|
||||
},
|
||||
CharacterState::Dance => {
|
||||
states::dance::Data::handle_event(&states::dance::Data, &j, action)
|
||||
},
|
||||
CharacterState::BasicBlock => {
|
||||
states::basic_block::Data.handle_event(&j, action)
|
||||
},
|
||||
@ -220,6 +225,7 @@ impl<'a> System<'a> for Sys {
|
||||
CharacterState::Climb => states::climb::Data.behavior(&j),
|
||||
CharacterState::Glide => states::glide::Data.behavior(&j),
|
||||
CharacterState::Sit => states::sit::Data::behavior(&states::sit::Data, &j),
|
||||
CharacterState::Dance => states::dance::Data::behavior(&states::dance::Data, &j),
|
||||
CharacterState::BasicBlock => states::basic_block::Data.behavior(&j),
|
||||
CharacterState::Roll(data) => data.behavior(&j),
|
||||
CharacterState::Wielding => states::wielding::Data.behavior(&j),
|
||||
|
@ -42,7 +42,7 @@ impl Default for ServerSettings {
|
||||
"xMAC94x",
|
||||
"Timo",
|
||||
"Songtronix",
|
||||
"Slipped",
|
||||
"slipped",
|
||||
"Sharp",
|
||||
"Acrimon",
|
||||
"imbris",
|
||||
|
@ -72,10 +72,10 @@ impl Animation for AlphaAnimation {
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = next.chest.ori * -0.45;
|
||||
|
||||
next.l_hand.offset = Vec3::new(-0.25, -5.0, 1.0);
|
||||
next.l_hand.offset = Vec3::new(-0.75, -1.0, -2.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.offset = Vec3::new(1.25, -5.5, -2.0);
|
||||
next.r_hand.offset = Vec3::new(0.75, -1.5, -5.5);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
@ -89,12 +89,20 @@ impl Animation for AlphaAnimation {
|
||||
* Quaternion::rotation_z(1.4 + slow * -0.5);
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.4, slow * -3.0 + quick * 3.0 - 4.0, 8.0);
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
slow * -3.0 + quick * 3.0 - 4.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(slow * 0.6)
|
||||
* Quaternion::rotation_y((slow * -0.2).max(0.0));
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, slow * 3.0 + quick * -3.0 + 5.0, 8.0);
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
slow * 3.0 + quick * -3.0 + 5.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(slow * -0.6)
|
||||
* Quaternion::rotation_y((slow * 0.2).min(0.0));
|
||||
next.r_foot.scale = Vec3::one();
|
||||
@ -161,14 +169,16 @@ impl Animation for AlphaAnimation {
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
},
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset = Vec3::new(0.0, 3.0, 8.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.l_hand.offset = Vec3::new(-7.0, 5.5, 3.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.3) * Quaternion::rotation_y(0.32);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.r_hand.offset = Vec3::new(8.0, 7.75, 0.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.3) * Quaternion::rotation_y(0.22);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
|
||||
next.main.ori = Quaternion::rotation_x(-0.3);
|
||||
next.main.offset = Vec3::new(6.0, 7.0, 0.0);
|
||||
next.main.ori = Quaternion::rotation_x(0.3)
|
||||
* Quaternion::rotation_y(-1.35)
|
||||
* Quaternion::rotation_z(1.57);
|
||||
next.head.offset =
|
||||
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
next.head.ori = Quaternion::rotation_z(slower * 0.05)
|
||||
@ -195,12 +205,14 @@ impl Animation for AlphaAnimation {
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
if velocity > 0.5 {
|
||||
next.l_foot.offset = Vec3::new(-3.4, foot * -2.0, 8.0);
|
||||
next.l_foot.offset =
|
||||
Vec3::new(-skeleton_attr.foot.0, foot * -2.0, skeleton_attr.foot.2);
|
||||
next.l_foot.ori = Quaternion::rotation_x(foot * -0.4)
|
||||
* Quaternion::rotation_z((slower * 0.6).max(0.0));
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, foot * 2.0, 8.0);
|
||||
next.r_foot.offset =
|
||||
Vec3::new(skeleton_attr.foot.0, foot * 2.0, skeleton_attr.foot.2);
|
||||
next.r_foot.ori = Quaternion::rotation_x(foot * 0.4)
|
||||
* Quaternion::rotation_z((slower * 0.6).max(0.0));
|
||||
next.r_foot.scale = Vec3::one();
|
||||
@ -208,12 +220,20 @@ impl Animation for AlphaAnimation {
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.15);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
} else {
|
||||
next.l_foot.offset = Vec3::new(-3.4, -2.5, 8.0 + (slower * 2.5).max(0.0));
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
-2.5,
|
||||
skeleton_attr.foot.2 + (slower * 2.5).max(0.0),
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(slower * -0.2 - 0.2)
|
||||
* Quaternion::rotation_z((slower * 1.0).max(0.0));
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 3.5 - slower * 2.0, 8.0);
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
3.5 - slower * 2.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(slower * 0.1)
|
||||
* Quaternion::rotation_z((slower * 0.5).max(0.0));
|
||||
next.r_foot.scale = Vec3::one();
|
||||
@ -222,10 +242,10 @@ impl Animation for AlphaAnimation {
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
}
|
||||
|
||||
next.control.offset = Vec3::new(-6.0, 3.0 + slower * 2.0, 8.0 + slower * 5.0);
|
||||
next.control.ori = Quaternion::rotation_x(-0.2 + slower * 1.8)
|
||||
next.control.offset = Vec3::new(-4.0, 3.0 + slower * 2.0, 5.0 + slower * 5.0);
|
||||
next.control.ori = Quaternion::rotation_x(-0.7 + slower * 1.8)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.4 + 1.57);
|
||||
* Quaternion::rotation_z(1.4);
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
|
@ -63,10 +63,10 @@ impl Animation for BetaAnimation {
|
||||
* Quaternion::rotation_x(slow * 0.1)
|
||||
* Quaternion::rotation_y(slow * -0.05);
|
||||
|
||||
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
|
||||
next.l_hand.offset = Vec3::new(-0.75, -1.0, -2.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
|
||||
next.r_hand.offset = Vec3::new(0.75, -1.5, -5.5);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
|
||||
@ -77,11 +77,16 @@ impl Animation for BetaAnimation {
|
||||
* Quaternion::rotation_y(slow * 2.0 + 0.7)
|
||||
* Quaternion::rotation_z(1.7 - slow * 0.4 + fast * 0.6);
|
||||
next.control.scale = Vec3::one();
|
||||
next.l_foot.offset = Vec3::new(-3.4, footquick * -9.5, 8.0);
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
footquick * -9.5,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(footquick * 0.3)
|
||||
* Quaternion::rotation_y(footquick * -0.6);
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, footquick * 9.5, 8.0);
|
||||
next.r_foot.offset =
|
||||
Vec3::new(skeleton_attr.foot.0, footquick * 9.5, skeleton_attr.foot.2);
|
||||
next.r_foot.ori = Quaternion::rotation_x(footquick * -0.3)
|
||||
* Quaternion::rotation_y(footquick * 0.2);
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
|
@ -6,12 +6,12 @@ use vek::*;
|
||||
pub struct ChargeAnimation;
|
||||
|
||||
impl Animation for ChargeAnimation {
|
||||
type Dependency = (Option<ToolKind>, f32, f64);
|
||||
type Dependency = (Option<ToolKind>, f32, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, velocity, _global_time): Self::Dependency,
|
||||
(active_tool_kind, velocity, orientation, last_ori, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
@ -47,24 +47,37 @@ impl Animation for ChargeAnimation {
|
||||
let stop = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
|
||||
let stopa = ((anim_time as f32).powf(0.9 as f32)).min(5.0);
|
||||
|
||||
let ori = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| Vec2::<f32>::from(o).magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + stop * -2.0,
|
||||
-2.0 + stop * 2.5 + skeleton_attr.head.0,
|
||||
skeleton_attr.head.1,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(stop * -1.0)
|
||||
* Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(stop * -0.3);
|
||||
next.head.ori =
|
||||
Quaternion::rotation_z(stop * -1.0 + tilt * -2.0) * Quaternion::rotation_y(stop * -0.3);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
|
||||
next.chest.ori = Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02);
|
||||
next.chest.ori = Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02 + tilt * -2.0);
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(stop * -0.5);
|
||||
next.belt.ori = Quaternion::rotation_z(stop * -0.5 + tilt * 2.0);
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(stop * -0.7);
|
||||
next.shorts.ori = Quaternion::rotation_z(stop * -0.7 + tilt * 4.0);
|
||||
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
@ -115,32 +128,47 @@ impl Animation for ChargeAnimation {
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
if velocity > 0.5 {
|
||||
next.l_foot.offset = Vec3::new(-3.4 - foot * 1.5, foote * 2.0, 8.0);
|
||||
|
||||
if velocity > 0.2 {
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0 - foot * 1.5,
|
||||
skeleton_attr.foot.1 + foote * 2.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(foote * -0.1)
|
||||
* Quaternion::rotation_z(0.4)
|
||||
* Quaternion::rotation_y(0.15);
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4 + foot * 1.5, foote * -1.5, 8.0);
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0 + foot * 1.5,
|
||||
skeleton_attr.foot.1 + foote * -1.5,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_z(0.4)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
|
||||
next.torso.offset =
|
||||
Vec3::new(0.0 + foot * 0.03, foote * 0.05, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
} else {
|
||||
next.l_foot.offset = Vec3::new(-3.4, -2.5 + stop * -1.3, 8.0);
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
-2.5 + stop * -1.3,
|
||||
skeleton_attr.foot.2 + tilt * -4.0 * foot,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(stop * -0.2 - 0.2 + stop * stress * 0.02)
|
||||
* Quaternion::rotation_z(stop * 0.1)
|
||||
* Quaternion::rotation_y(stop * 0.08);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 3.5 + stop * 1.5, 8.0);
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
3.5 + stop * 1.5,
|
||||
skeleton_attr.foot.2 + tilt * 4.0 * foot,
|
||||
);
|
||||
next.r_foot.ori =
|
||||
Quaternion::rotation_x(stop * 0.1) * Quaternion::rotation_z(stop * 0.1);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
@ -74,7 +74,7 @@ impl Animation for ClimbAnimation {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 + quicka * 1.5,
|
||||
skeleton_attr.hand.2 - quick * 4.0,
|
||||
5.0 + skeleton_attr.hand.2 - quick * 4.0,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_x(2.2 + quicka * 0.5);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
@ -82,7 +82,7 @@ impl Animation for ClimbAnimation {
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 - quicka * 1.5,
|
||||
skeleton_attr.hand.2 + quick * 4.0,
|
||||
5.0 + skeleton_attr.hand.2 + quick * 4.0,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(2.2 - quicka * 0.5);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
161
voxygen/src/anim/character/dance.rs
Normal file
161
voxygen/src/anim/character/dance.rs
Normal file
@ -0,0 +1,161 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::ToolKind;
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct DanceAnimation;
|
||||
|
||||
impl Animation for DanceAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
*rate = 1.0;
|
||||
|
||||
let lab = 1.0;
|
||||
let short = (((5.0)
|
||||
/ (3.0 + 2.0 * ((anim_time as f32 * lab as f32 * 6.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 6.0).sin());
|
||||
let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin();
|
||||
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
|
||||
|
||||
let shorte = (anim_time as f32 * lab as f32 * 6.0).sin();
|
||||
|
||||
let shortealt = (anim_time as f32 * lab as f32 * 6.0 + PI / 2.0).sin();
|
||||
|
||||
let foot = (((5.0)
|
||||
/ (1.0 + (4.0) * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 6.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.3,
|
||||
((global_time + anim_time) as f32 / 6.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.15,
|
||||
);
|
||||
|
||||
next.head.offset = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
next.head.ori = Quaternion::rotation_z(short * -0.6)
|
||||
* Quaternion::rotation_x(0.2 + head_look.y.max(0.0) + shorte.abs() * -0.2);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + shortealt * 1.5,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_z(short * 0.35)
|
||||
* Quaternion::rotation_y(shorte * 0.08)
|
||||
* Quaternion::rotation_x(foot * 0.07);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(shorte * 0.25);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
next.back.ori = Quaternion::rotation_x(-0.25 + shorte * 0.1 + noisea * 0.1 + noiseb * 0.1);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(foot * 0.35);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
1.0 - skeleton_attr.hand.0,
|
||||
2.0 + skeleton_attr.hand.1 + shortealt * -3.0,
|
||||
skeleton_attr.hand.2 + shortealt * -0.75,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.4 + foot * 0.15) * Quaternion::rotation_y(0.2);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
-1.0 + skeleton_attr.hand.0,
|
||||
2.0 + skeleton_attr.hand.1 + shortealt * 3.0,
|
||||
skeleton_attr.hand.2 + shortealt * 0.75,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.4 + foot * -0.15) * Quaternion::rotation_y(-0.2);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0 + foot * 0.8,
|
||||
1.5 + -skeleton_attr.foot.1 + foot * -4.0,
|
||||
skeleton_attr.foot.2 + 2.0,
|
||||
);
|
||||
next.l_foot.ori =
|
||||
Quaternion::rotation_x(foot * -0.3) * Quaternion::rotation_z(short * -0.15);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0 + foot * 0.8,
|
||||
1.5 + -skeleton_attr.foot.1 + foot * 4.0,
|
||||
skeleton_attr.foot.2 + 2.0,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(foot * 0.3) * Quaternion::rotation_z(short * 0.15);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(shorte * 0.15);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(shorte * -0.15);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.main.offset = Vec3::new(-7.0, -6.5, 15.0);
|
||||
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + shorte * 0.25);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.second.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.lantern.offset = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.lantern.ori =
|
||||
Quaternion::rotation_x(shorte * 0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, -0.3, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_z(short * -0.2);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.control.ori = Quaternion::rotation_x(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.l_control.scale = Vec3::one();
|
||||
|
||||
next.r_control.scale = Vec3::one();
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -54,10 +54,10 @@ impl Animation for DashAnimation {
|
||||
next.shorts.offset = Vec3::new(0.0, 3.0, -3.0);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.4) * Quaternion::rotation_z(0.3);
|
||||
|
||||
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
|
||||
next.l_hand.offset = Vec3::new(-0.75, -1.0, -2.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
|
||||
next.r_hand.offset = Vec3::new(0.75, -1.5, -5.5);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
|
||||
@ -68,10 +68,10 @@ impl Animation for DashAnimation {
|
||||
next.control.ori =
|
||||
Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(1.1 + slow * 0.2);
|
||||
next.control.scale = Vec3::one();
|
||||
next.l_foot.offset = Vec3::new(-1.4, foot * 3.0 + 2.0, 8.0);
|
||||
next.l_foot.offset = Vec3::new(-1.4, foot * 3.0 + 2.0, skeleton_attr.foot.2);
|
||||
next.l_foot.ori = Quaternion::rotation_x(foot * -0.4 - 0.8);
|
||||
|
||||
next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 1.0, 8.0);
|
||||
next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 1.0, skeleton_attr.foot.2);
|
||||
next.r_foot.ori = Quaternion::rotation_x(foot * 0.4 - 0.8);
|
||||
},
|
||||
_ => {},
|
||||
|
@ -37,10 +37,10 @@ impl Animation for EquipAnimation {
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Sword(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-0.25, -5.0, -5.0);
|
||||
next.l_hand.offset = Vec3::new(-0.75, -1.0, -2.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(-0.2);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
next.r_hand.offset = Vec3::new(1.25, -5.5, -8.0);
|
||||
next.r_hand.offset = Vec3::new(0.75, -1.5, -5.5);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.3);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 0.0, -6.0);
|
||||
@ -76,10 +76,10 @@ impl Animation for EquipAnimation {
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-7.0 + 9.0, 4.6 + 1.5, 7.5 - 1.6);
|
||||
next.l_hand.offset = Vec3::new(-7.0, 5.5, 3.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.32);
|
||||
next.l_hand.scale = Vec3::one() * 1.08;
|
||||
next.r_hand.offset = Vec3::new(8.0, 5.75, 4.0);
|
||||
next.r_hand.offset = Vec3::new(8.0, 7.75, 0.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.22);
|
||||
next.r_hand.scale = Vec3::one() * 1.06;
|
||||
next.main.offset = Vec3::new(6.0, 7.0, 0.0);
|
||||
|
@ -42,18 +42,17 @@ impl Animation for GlidingAnimation {
|
||||
|
||||
let ori = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| Vec2::<f32>::from(o).magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.map(|m| m > 0.0001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.15)
|
||||
ori.angle_between(last_ori).min(0.05)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 0.8;
|
||||
};
|
||||
|
||||
next.head.offset = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
next.head.ori = Quaternion::rotation_x(0.35 - slow * 0.10 + head_look.y)
|
||||
@ -68,15 +67,15 @@ impl Animation for GlidingAnimation {
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(slowa * 0.35);
|
||||
|
||||
next.l_hand.offset = Vec3::new(-9.5 + slowa * -1.5, -3.0 + slowa * 1.5, 8.0);
|
||||
next.l_hand.offset = Vec3::new(-9.5 + slowa * -1.5, -3.0 + slowa * 1.5, 10.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(-2.7 + slowa * -0.1);
|
||||
|
||||
next.r_hand.offset = Vec3::new(9.5 + slowa * -1.5, -3.0 + slowa * -1.5, 8.0);
|
||||
next.r_hand.offset = Vec3::new(9.5 + slowa * -1.5, -3.0 + slowa * -1.5, 10.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(-2.7 + slowa * -0.10);
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
2.0 + skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.1,
|
||||
-9.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(
|
||||
@ -86,7 +85,7 @@ impl Animation for GlidingAnimation {
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
2.0 + skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.1,
|
||||
-9.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(
|
||||
@ -127,7 +126,7 @@ impl Animation for GlidingAnimation {
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 6.0, 15.0) / 11.0 * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_x(-0.05 * speed.max(12.0) + slow * 0.06)
|
||||
* Quaternion::rotation_y(tilt * 16.0);
|
||||
* Quaternion::rotation_y(tilt * 32.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
|
@ -1,39 +1,61 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::ToolKind;
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
impl Animation for JumpAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, _global_time): Self::Dependency,
|
||||
(_active_tool_kind, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
let quick = (anim_time as f32 * 14.0).sin();
|
||||
let slow = (anim_time as f32 * 7.0).sin();
|
||||
let stop = (anim_time as f32 * 1.5).min(PI / 2.0).sin();
|
||||
|
||||
let random = ((((2.0
|
||||
* ((global_time as f32 - anim_time as f32)
|
||||
- ((global_time as f32 - anim_time as f32).round())))
|
||||
.abs())
|
||||
* 10.0)
|
||||
.round())
|
||||
/ 10.0;
|
||||
|
||||
let switch = if random > 0.5 { 1.0 } else { -1.0 };
|
||||
|
||||
let ori = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| Vec2::<f32>::from(o).magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-3.0 + skeleton_attr.head.0,
|
||||
-1.0 + skeleton_attr.head.1,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_x(0.25 + stop * 0.1 + slow * 0.04);
|
||||
next.head.ori =
|
||||
Quaternion::rotation_x(0.25 + slow * 0.04) * Quaternion::rotation_z(tilt * -2.5);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1 + 1.0);
|
||||
next.chest.ori = Quaternion::rotation_z(0.0);
|
||||
next.chest.ori = Quaternion::rotation_z(tilt * -2.0);
|
||||
next.chest.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(0.0);
|
||||
next.belt.ori = Quaternion::rotation_z(tilt * 2.0);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
@ -41,41 +63,61 @@ impl Animation for JumpAnimation {
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(0.0);
|
||||
next.shorts.ori = Quaternion::rotation_z(tilt * 3.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0 + stop * -1.8,
|
||||
skeleton_attr.hand.1 + stop * 2.0,
|
||||
-2.0 + skeleton_attr.hand.2 + stop * 3.2 - quick * 0.4,
|
||||
);
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(stop * 1.2 + slow * 0.3) * Quaternion::rotation_y(stop * 0.2);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
if random > 0.5 {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0,
|
||||
1.0 + skeleton_attr.hand.1 + 4.0,
|
||||
2.0 + skeleton_attr.hand.2 + slow * 1.5,
|
||||
);
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(1.9 + slow * 0.4) * Quaternion::rotation_y(0.2);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0 + stop * 1.8,
|
||||
skeleton_attr.hand.1 + stop * -2.0,
|
||||
-2.0 + skeleton_attr.hand.2 + stop * 3.2 - quick * 0.4,
|
||||
);
|
||||
next.r_hand.ori =
|
||||
Quaternion::rotation_x(-stop * 1.2 + slow * -0.3) * Quaternion::rotation_y(stop * -0.2);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 - 3.0,
|
||||
skeleton_attr.hand.2 + slow * 1.5,
|
||||
);
|
||||
next.r_hand.ori =
|
||||
Quaternion::rotation_x(-0.5 + slow * -0.4) * Quaternion::rotation_y(-0.2);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
} else {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 - 3.0,
|
||||
skeleton_attr.hand.2 + slow * 1.5,
|
||||
);
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(-0.5 + slow * -0.4) * Quaternion::rotation_y(0.2);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0,
|
||||
1.0 + skeleton_attr.hand.1 + 4.0,
|
||||
2.0 + skeleton_attr.hand.2 + slow * 1.5,
|
||||
);
|
||||
next.r_hand.ori =
|
||||
Quaternion::rotation_x(1.9 + slow * 0.4) * Quaternion::rotation_y(-0.2);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
};
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2,
|
||||
skeleton_attr.foot.1 - 6.0 * switch,
|
||||
1.0 + skeleton_attr.foot.2 + slow * 1.5,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(stop * -1.2 + slow * -0.3);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-1.2 * switch + slow * -0.2 * switch);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2,
|
||||
skeleton_attr.foot.1 + 6.0 * switch,
|
||||
1.0 + skeleton_attr.foot.2 + slow * 1.5,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(stop * 1.2 + slow * 0.3);
|
||||
next.r_foot.ori = Quaternion::rotation_x(1.2 * switch + slow * 0.2 * switch);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
@ -83,7 +125,7 @@ impl Animation for JumpAnimation {
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(stop * 0.3);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(0.4 * switch);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
@ -91,7 +133,7 @@ impl Animation for JumpAnimation {
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(-stop * 0.3);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(-0.4 * switch);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);
|
||||
@ -110,8 +152,8 @@ impl Animation for JumpAnimation {
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.lantern.ori = Quaternion::rotation_x(stop * 1.2 + slow * 0.3)
|
||||
* Quaternion::rotation_y(stop * 0.4 + slow * 0.3);
|
||||
next.lantern.ori = 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.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
|
@ -4,6 +4,7 @@ pub mod block;
|
||||
pub mod blockidle;
|
||||
pub mod charge;
|
||||
pub mod climb;
|
||||
pub mod dance;
|
||||
pub mod dash;
|
||||
pub mod equip;
|
||||
pub mod gliding;
|
||||
@ -22,10 +23,10 @@ pub mod wield;
|
||||
pub use self::{
|
||||
alpha::AlphaAnimation, beta::BetaAnimation, block::BlockAnimation,
|
||||
blockidle::BlockIdleAnimation, charge::ChargeAnimation, climb::ClimbAnimation,
|
||||
dash::DashAnimation, equip::EquipAnimation, gliding::GlidingAnimation, idle::IdleAnimation,
|
||||
jump::JumpAnimation, roll::RollAnimation, run::RunAnimation, shoot::ShootAnimation,
|
||||
sit::SitAnimation, spin::SpinAnimation, stand::StandAnimation, swim::SwimAnimation,
|
||||
wield::WieldAnimation,
|
||||
dance::DanceAnimation, dash::DashAnimation, equip::EquipAnimation, gliding::GlidingAnimation,
|
||||
idle::IdleAnimation, jump::JumpAnimation, roll::RollAnimation, run::RunAnimation,
|
||||
shoot::ShootAnimation, sit::SitAnimation, spin::SpinAnimation, stand::StandAnimation,
|
||||
swim::SwimAnimation, wield::WieldAnimation,
|
||||
};
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
@ -50,6 +51,7 @@ pub struct CharacterSkeleton {
|
||||
main: Bone,
|
||||
second: Bone,
|
||||
lantern: Bone,
|
||||
hold: Bone,
|
||||
torso: Bone,
|
||||
control: Bone,
|
||||
l_control: Bone,
|
||||
@ -104,7 +106,9 @@ impl Skeleton for CharacterSkeleton {
|
||||
torso_mat * chest_mat * control_mat * r_control_mat * second_mat,
|
||||
),
|
||||
FigureBoneData::new(lantern_final_mat),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::new(
|
||||
torso_mat * chest_mat * l_hand_mat * self.hold.compute_base_matrix(),
|
||||
),
|
||||
],
|
||||
(lantern_final_mat * Vec4::new(0.0, 0.0, 0.0, 1.0)).xyz(),
|
||||
)
|
||||
@ -126,6 +130,7 @@ impl Skeleton for CharacterSkeleton {
|
||||
self.main.interpolate(&target.main, dt);
|
||||
self.second.interpolate(&target.second, dt);
|
||||
self.lantern.interpolate(&target.lantern, dt);
|
||||
self.hold.interpolate(&target.hold, dt);
|
||||
self.torso.interpolate(&target.torso, dt);
|
||||
self.control.interpolate(&target.control, dt);
|
||||
self.l_control.interpolate(&target.l_control, dt);
|
||||
@ -216,18 +221,18 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
|
||||
(Danari, Female) => 1.15,
|
||||
},
|
||||
head: match (body.race, body.body_type) {
|
||||
(Orc, Male) => (0.0, 14.0),
|
||||
(Orc, Female) => (0.0, 14.0),
|
||||
(Human, Male) => (0.3, 13.5),
|
||||
(Human, Female) => (0.0, 13.8),
|
||||
(Elf, Male) => (0.5, 13.5),
|
||||
(Elf, Female) => (1.0, 13.5),
|
||||
(Dwarf, Male) => (0.0, 14.5),
|
||||
(Dwarf, Female) => (0.0, 14.0),
|
||||
(Undead, Male) => (0.5, 13.6),
|
||||
(Undead, Female) => (0.5, 14.5),
|
||||
(Danari, Male) => (0.5, 14.0),
|
||||
(Danari, Female) => (0.5, 14.0),
|
||||
(Orc, Male) => (0.0, 13.5),
|
||||
(Orc, Female) => (0.0, 13.0),
|
||||
(Human, Male) => (0.3, 13.0),
|
||||
(Human, Female) => (0.0, 13.5),
|
||||
(Elf, Male) => (0.5, 13.0),
|
||||
(Elf, Female) => (1.0, 13.0),
|
||||
(Dwarf, Male) => (0.0, 14.0),
|
||||
(Dwarf, Female) => (0.0, 13.5),
|
||||
(Undead, Male) => (0.5, 13.0),
|
||||
(Undead, Female) => (0.5, 14.0),
|
||||
(Danari, Male) => (0.5, 12.5),
|
||||
(Danari, Female) => (0.5, 13.5),
|
||||
},
|
||||
chest: match (body.race, body.body_type) {
|
||||
(_, _) => (0.0, 7.0),
|
||||
@ -242,10 +247,10 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
|
||||
(_, _) => (0.0, -5.0),
|
||||
},
|
||||
hand: match (body.race, body.body_type) {
|
||||
(_, _) => (7.0, -0.25, 5.0),
|
||||
(_, _) => (7.0, -0.25, 0.5),
|
||||
},
|
||||
foot: match (body.race, body.body_type) {
|
||||
(_, _) => (3.4, -0.1, 8.0),
|
||||
(_, _) => (3.4, 0.5, 1.0),
|
||||
},
|
||||
shoulder: match (body.race, body.body_type) {
|
||||
(_, _) => (5.0, 0.0, 5.0),
|
||||
|
@ -1,6 +1,5 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::ToolKind;
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct RollAnimation;
|
||||
@ -19,95 +18,89 @@ impl Animation for RollAnimation {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave = (anim_time as f32 * 4.5).sin();
|
||||
let wave_quick = (anim_time as f32 * 7.5).sin();
|
||||
let wave_quick_cos = (anim_time as f32 * 7.5).cos();
|
||||
let wave_slow = (anim_time as f32 * 2.3 + PI).sin();
|
||||
let wave_dub = (anim_time as f32 * 4.5).sin();
|
||||
|
||||
let spin = anim_time as f32;
|
||||
let ori = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| Vec2::<f32>::from(o).magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.map(|m| m > 0.0001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.5)
|
||||
ori.angle_between(last_ori).min(0.05)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
};
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-2.0 + skeleton_attr.head.0 + 3.0,
|
||||
skeleton_attr.head.1 - 2.0,
|
||||
skeleton_attr.head.1 - 1.0,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_x(wave_dub * -0.8);
|
||||
next.head.ori = Quaternion::rotation_x(-0.75);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + wave_dub * -5.0,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_x(wave_dub * 0.4);
|
||||
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, -9.5 + skeleton_attr.chest.1);
|
||||
next.chest.ori = Quaternion::rotation_x(-0.2);
|
||||
next.chest.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + 2.0, skeleton_attr.belt.1 + 2.0);
|
||||
next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.8);
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + 1.0, skeleton_attr.belt.1 + 1.0);
|
||||
next.belt.ori = Quaternion::rotation_x(0.55);
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.shorts.0 + 2.0,
|
||||
skeleton_attr.shorts.1 + 3.0,
|
||||
skeleton_attr.shorts.0 + 4.5,
|
||||
skeleton_attr.shorts.1 + 2.5,
|
||||
);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.8);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.8);
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.chest.0 + wave * -0.5,
|
||||
skeleton_attr.hand.1 + wave_quick_cos * -5.5,
|
||||
skeleton_attr.hand.2 + wave_quick * 0.5,
|
||||
-skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 + 1.0,
|
||||
skeleton_attr.hand.2 + 2.0,
|
||||
);
|
||||
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(wave * 0.3);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.6);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0 + wave * 0.5,
|
||||
skeleton_attr.hand.1 + wave_quick_cos * 2.5,
|
||||
skeleton_attr.hand.2 + wave_quick * 3.0,
|
||||
-1.0 + skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 + 1.0,
|
||||
skeleton_attr.hand.2 + 2.0,
|
||||
);
|
||||
next.r_hand.ori =
|
||||
Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(wave * 0.3);
|
||||
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.6);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2 + wave_dub * -1.2,
|
||||
1.0 - skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + 5.5,
|
||||
skeleton_attr.foot.2 - 5.0,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(wave * 0.6);
|
||||
next.l_foot.ori = Quaternion::rotation_x(0.9);
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2 + wave_dub * -1.0,
|
||||
skeleton_attr.foot.1 + 5.5,
|
||||
skeleton_attr.foot.2 - 5.0,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(wave * -0.4);
|
||||
next.r_foot.ori = Quaternion::rotation_x(0.9);
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.2,
|
||||
skeleton_attr.shoulder.1 + 2.0,
|
||||
skeleton_attr.shoulder.2 + 1.0,
|
||||
);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
@ -121,7 +114,7 @@ impl Animation for RollAnimation {
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.second.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.scale = Vec3::one() * 0.0;
|
||||
next.second.scale = Vec3::one();
|
||||
|
||||
next.lantern.offset = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
@ -131,9 +124,9 @@ impl Animation for RollAnimation {
|
||||
next.lantern.ori = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
next.torso.offset =
|
||||
Vec3::new(0.0, 0.0, 0.0 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(tilt);
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 8.0) / 11.0 * skeleton_attr.scaler;
|
||||
next.torso.ori =
|
||||
Quaternion::rotation_x(spin * -10.0) * Quaternion::rotation_z(tilt * -10.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
@ -21,11 +21,33 @@ impl Animation for RunAnimation {
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
*rate = 1.0;
|
||||
|
||||
let walkintensity = if speed > 5.0 { 1.0 } else { 0.7 };
|
||||
let walkintensity = if speed > 5.0 { 1.0 } else { 0.45 };
|
||||
let walk = if speed > 5.0 { 1.0 } else { 0.5 };
|
||||
let lower = if speed > 5.0 { 0.0 } else { 1.0 };
|
||||
let snapfoot = if speed > 5.0 { 1.1 } else { 2.0 };
|
||||
let _snapfoot = if speed > 5.0 { 1.1 } else { 2.0 };
|
||||
let lab = 1.0;
|
||||
let foothoril = (anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.45).sin();
|
||||
let foothorir = (anim_time as f32 * 16.0 * walk * lab as f32 + PI * (0.45)).sin();
|
||||
|
||||
let footvertl = (anim_time as f32 * 16.0 * walk * lab as f32).sin();
|
||||
let footvertr = (anim_time as f32 * 16.0 * walk * lab as f32 + PI).sin();
|
||||
|
||||
let footrotl = (((5.0)
|
||||
/ (2.5
|
||||
+ (2.5)
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin());
|
||||
|
||||
let footrotr = (((5.0)
|
||||
/ (1.0
|
||||
+ (4.0)
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 0.4).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 0.4).sin());
|
||||
|
||||
let short = (((5.0)
|
||||
/ (1.5
|
||||
+ 3.5 * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powf(2.0 as f32)))
|
||||
@ -40,20 +62,8 @@ impl Animation for RunAnimation {
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 16.0 * walk).sin());
|
||||
|
||||
let shortalt = (((5.0)
|
||||
/ (1.5
|
||||
+ 3.5
|
||||
* ((anim_time as f32 * lab as f32 * 16.0 * walk + PI / 2.0).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 16.0 * walk + PI / 2.0).sin());
|
||||
|
||||
let foot = (((5.0)
|
||||
/ (snapfoot
|
||||
+ (5.0 - snapfoot)
|
||||
* ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 16.0 * walk).sin());
|
||||
let shortalt = (anim_time as f32 * lab as f32 * 16.0 * walk + PI / 2.0).sin();
|
||||
let shortalter = (anim_time as f32 * lab as f32 * 16.0 * walk + PI / -2.0).sin();
|
||||
|
||||
let wave_stop = (anim_time as f32 * 26.0).min(PI / 2.0 / 2.0).sin();
|
||||
|
||||
@ -78,7 +88,7 @@ impl Animation for RunAnimation {
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.5)
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
@ -87,22 +97,25 @@ impl Animation for RunAnimation {
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-3.0 + skeleton_attr.head.0,
|
||||
-1.0 + skeleton_attr.head.1 + short * 0.1,
|
||||
skeleton_attr.head.1 + short * 0.1,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x - short * 0.1)
|
||||
* Quaternion::rotation_x(head_look.y + 0.35);
|
||||
next.head.ori = Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.1)
|
||||
* Quaternion::rotation_x(head_look.y + 0.45 - lower * 0.35);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + 2.0 + short * 1.1 - lower,
|
||||
skeleton_attr.chest.1 + 2.0 + shortalt * -1.5 - lower,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_z(short * 0.15 * walkintensity);
|
||||
next.chest.ori = Quaternion::rotation_z(short * 0.18 * walkintensity + tilt * -0.6)
|
||||
* Quaternion::rotation_y(tilt * 1.6)
|
||||
* Quaternion::rotation_x(shortalter * 0.035 + wave_stop * speed * -0.07 + (tilt.abs()));
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(short * 0.1);
|
||||
next.belt.ori =
|
||||
Quaternion::rotation_z(short * 0.1 + tilt * -1.1) * Quaternion::rotation_y(tilt * 0.5);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
@ -110,41 +123,44 @@ impl Animation for RunAnimation {
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(short * 0.2);
|
||||
next.shorts.ori =
|
||||
Quaternion::rotation_z(short * 0.25 + tilt * -1.5) * Quaternion::rotation_y(tilt * 0.7);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0 + wave_stop * 1.0 * walkintensity,
|
||||
skeleton_attr.hand.1 + short * 3.0 * walkintensity,
|
||||
1.0 + skeleton_attr.hand.2 + short * -0.75 * walkintensity,
|
||||
-skeleton_attr.hand.0 + foothorir * -1.3,
|
||||
3.0 + skeleton_attr.hand.1 + foothorir * -7.0 * walkintensity,
|
||||
1.5 + skeleton_attr.hand.2 - foothorir * 5.5 * walkintensity,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.2 + short * 1.5 * walk)
|
||||
* Quaternion::rotation_y(wave_stop * -0.1);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.6 + footrotr * -1.2 * walkintensity)
|
||||
* Quaternion::rotation_y(footrotr * 0.4 * walkintensity);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0 + wave_stop * -1.0 * walkintensity,
|
||||
skeleton_attr.hand.1 + short * -3.0 * walkintensity,
|
||||
1.0 + skeleton_attr.hand.2 + short * 0.75 * walkintensity,
|
||||
skeleton_attr.hand.0 + foothoril * 1.3,
|
||||
3.0 + skeleton_attr.hand.1 + foothoril * -6.5 * walkintensity,
|
||||
1.5 + skeleton_attr.hand.2 - foothoril * 7.0 * walkintensity,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.2 + short * -1.5 * walk)
|
||||
* Quaternion::rotation_y(wave_stop * 0.1);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.6 + footrotl * -1.2 * walkintensity)
|
||||
* Quaternion::rotation_y(footrotl * -0.4 * walkintensity);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
-skeleton_attr.foot.1 + foot * 1.0,
|
||||
skeleton_attr.foot.2 + 1.0,
|
||||
-1.5 + skeleton_attr.foot.1 + foothoril * -8.5 * walkintensity - lower * 1.0,
|
||||
2.0 + skeleton_attr.foot.2 + ((footvertl * -2.7).max(-1.0)) * walkintensity,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(foot * -1.2 * walkintensity);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.2 + footrotl * -1.2 * walkintensity)
|
||||
* Quaternion::rotation_y(tilt * 1.8);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
-skeleton_attr.foot.1 + foot * -1.0,
|
||||
skeleton_attr.foot.2 + 1.0,
|
||||
-1.5 + skeleton_attr.foot.1 + foothorir * -8.5 * walkintensity - lower * 1.0,
|
||||
2.0 + skeleton_attr.foot.2 + ((footvertr * -2.7).max(-1.0)) * walkintensity,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(foot * 1.2 * walkintensity);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.2 + footrotr * -1.2 * walkintensity)
|
||||
* Quaternion::rotation_y(tilt * 1.8);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
@ -178,13 +194,11 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.lantern.ori =
|
||||
Quaternion::rotation_x(shorte * -0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
|
||||
Quaternion::rotation_x(shorte * 0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, -0.3 + shortalt * -0.065, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.ori =
|
||||
Quaternion::rotation_x(wave_stop * speed * -0.05 + wave_stop * speed * -0.005)
|
||||
* Quaternion::rotation_y(tilt);
|
||||
next.torso.offset = Vec3::new(0.0, -0.3, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_y(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
@ -60,10 +60,10 @@ impl Animation for ShootAnimation {
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset = Vec3::new(1.0, -2.0, -5.0);
|
||||
next.l_hand.offset = Vec3::new(1.5, 0.5, -4.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.3);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.offset = Vec3::new(9.0, 1.0, 0.0);
|
||||
next.r_hand.offset = Vec3::new(8.0, 4.0, 2.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.8)
|
||||
* Quaternion::rotation_y(0.5)
|
||||
* Quaternion::rotation_z(-0.27);
|
||||
@ -104,15 +104,21 @@ impl Animation for ShootAnimation {
|
||||
_ => {},
|
||||
}
|
||||
if velocity > 0.5 {
|
||||
next.l_foot.offset =
|
||||
Vec3::new(-3.4 - foot * 1.0 + exp * -1.0, foote * 0.8 + exp * 1.5, 8.0);
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0 - foot * 1.0 + exp * -1.0,
|
||||
foote * 0.8 + exp * 1.5,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(exp * 0.5)
|
||||
* Quaternion::rotation_z(exp * 0.4)
|
||||
* Quaternion::rotation_y(0.15);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset =
|
||||
Vec3::new(3.4 + foot * 1.0 + exp * 1.0, foote * -0.8 + exp * -1.0, 8.0);
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0 + foot * 1.0 + exp * 1.0,
|
||||
foote * -0.8 + exp * -1.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(exp * -0.5)
|
||||
* Quaternion::rotation_z(exp * 0.4)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
@ -121,11 +127,16 @@ impl Animation for ShootAnimation {
|
||||
next.torso.ori = Quaternion::rotation_x(-0.15);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
} else {
|
||||
next.l_foot.offset = Vec3::new(-3.4, -2.5, 8.0 + exp * 2.5);
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
-2.5,
|
||||
skeleton_attr.foot.2 + exp * 2.5,
|
||||
);
|
||||
next.l_foot.ori =
|
||||
Quaternion::rotation_x(exp * -0.2 - 0.2) * Quaternion::rotation_z(exp * 1.0);
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 3.5 - exp * 2.0, 8.0);
|
||||
next.r_foot.offset =
|
||||
Vec3::new(skeleton_attr.foot.0, 3.5 - exp * 2.0, skeleton_attr.foot.2);
|
||||
next.r_foot.ori = Quaternion::rotation_x(exp * 0.1) * Quaternion::rotation_z(exp * 0.5);
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0);
|
||||
|
@ -85,16 +85,16 @@ impl Animation for SitAnimation {
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2,
|
||||
4.0 + skeleton_attr.foot.1,
|
||||
3.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(slow * 0.1 + stop * 1.2 + slow * 0.1);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2,
|
||||
4.0 + skeleton_attr.foot.1,
|
||||
3.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(slowa * 0.1 + stop * 1.2 + slowa * 0.1);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
@ -38,10 +38,10 @@ impl Animation for SpinAnimation {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Axe(_)) | Some(ToolKind::Hammer(_)) | Some(ToolKind::Sword(_)) => {
|
||||
//INTENTION: SWORD
|
||||
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
|
||||
next.l_hand.offset = Vec3::new(-0.75, -1.0, -2.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
|
||||
next.r_hand.offset = Vec3::new(0.75, -1.5, -5.5);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
|
||||
@ -85,11 +85,11 @@ impl Animation for SpinAnimation {
|
||||
|
||||
_ => {},
|
||||
}
|
||||
next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 8.0);
|
||||
next.l_foot.offset = Vec3::new(-skeleton_attr.foot.0, foot * 1.0, skeleton_attr.foot.2);
|
||||
next.l_foot.ori = Quaternion::rotation_x(foot * -1.2);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, foot * -1.0, 8.0);
|
||||
next.r_foot.offset = Vec3::new(skeleton_attr.foot.0, foot * -1.0, skeleton_attr.foot.2);
|
||||
next.r_foot.ori = Quaternion::rotation_x(foot * 1.2);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
|
@ -6,12 +6,12 @@ use vek::*;
|
||||
pub struct SwimAnimation;
|
||||
|
||||
impl Animation for SwimAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, f32, f64);
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, velocity, _orientation, global_time): Self::Dependency,
|
||||
(_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
@ -43,7 +43,19 @@ impl Animation for SwimAnimation {
|
||||
.sin()
|
||||
* 0.1,
|
||||
);
|
||||
|
||||
let ori = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| Vec2::<f32>::from(o).magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-3.0 + skeleton_attr.head.0,
|
||||
@ -75,34 +87,34 @@ impl Animation for SwimAnimation {
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 - foot * 1.2,
|
||||
skeleton_attr.hand.2 + foot * -3.0,
|
||||
1.5 + skeleton_attr.hand.1 - foot * 1.2,
|
||||
2.0 + skeleton_attr.hand.2 + foot * -3.0,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.8 + foot * -0.6) * Quaternion::rotation_y(0.2);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 + foot * 1.2,
|
||||
skeleton_attr.hand.2 + foot * 3.0,
|
||||
1.5 + skeleton_attr.hand.1 + foot * 1.2,
|
||||
2.0 + skeleton_attr.hand.2 + foot * 3.0,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.8 + foot * 0.6) * Quaternion::rotation_y(-0.2);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
4.0 + skeleton_attr.foot.1 + foot * 1.2,
|
||||
-5.0 + skeleton_attr.foot.2 + foot * 6.5,
|
||||
skeleton_attr.foot.1 + foot * 1.2,
|
||||
-3.0 + skeleton_attr.foot.2 + foot * 3.5,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-1.40 + foot * 0.6);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-1.1 + foot * 0.6);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
4.0 + skeleton_attr.foot.1 - foot * 1.2,
|
||||
-5.0 + skeleton_attr.foot.2 + foot * -6.5,
|
||||
skeleton_attr.foot.1 - foot * 1.2,
|
||||
-3.0 + skeleton_attr.foot.2 + foot * -3.5,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-1.40 + foot * -0.6);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-1.1 + foot * -0.6);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
@ -139,7 +151,8 @@ impl Animation for SwimAnimation {
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, -0.3 + shortalt * -0.065, 0.4) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05);
|
||||
next.torso.ori = Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05)
|
||||
* Quaternion::rotation_z(tilt * 12.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
|
@ -21,71 +21,77 @@ impl Animation for WieldAnimation {
|
||||
|
||||
let mut next = (*skeleton).clone();
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 10.0)
|
||||
((global_time + anim_time) as f32 / 3.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.2,
|
||||
((global_time + anim_time) as f32 / 10.0)
|
||||
((global_time + anim_time) as f32 / 3.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.1,
|
||||
);
|
||||
|
||||
let slow_cos = (anim_time as f32 * 6.0 + PI).cos();
|
||||
let ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
|
||||
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 ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
|
||||
let u_slowalt = (anim_time as f32 * 3.0 + PI).cos();
|
||||
let short = (((5.0)
|
||||
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 16.0).sin());
|
||||
let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin();
|
||||
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
|
||||
let wave = (anim_time as f32 * 16.0).sin();
|
||||
|
||||
if velocity > 0.5 {
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_x(-0.2);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.back.offset = Vec3::new(0.0, -2.8, 7.25);
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
next.back.ori = Quaternion::rotation_x(
|
||||
(-0.25 + short * 0.3 + noisea * 0.4 + noiseb * 0.4).min(-0.1),
|
||||
(-0.5 + short * 0.3 + noisea * 0.3 + noiseb * 0.3).min(-0.1),
|
||||
);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
} else {
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-2.0 + skeleton_attr.head.0,
|
||||
skeleton_attr.head.1 + ultra_slow * 0.1,
|
||||
skeleton_attr.head.1 + u_slow * 0.1,
|
||||
);
|
||||
next.head.ori =
|
||||
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0 + slow_cos * 0.5,
|
||||
0.0 + slowalt * 0.5,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + ultra_slow * 0.5,
|
||||
skeleton_attr.chest.1 + u_slow * 0.5,
|
||||
);
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.4, -2.5, 9.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(ultra_slow_cos * 0.035 - 0.2);
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(u_slowalt * 0.035 - 0.2);
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 3.5, 9.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(ultra_slow * 0.035);
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(u_slow * 0.035);
|
||||
|
||||
next.chest.ori =
|
||||
Quaternion::rotation_y(ultra_slow_cos * 0.04) * Quaternion::rotation_z(0.15);
|
||||
Quaternion::rotation_y(u_slowalt * 0.04) * Quaternion::rotation_z(0.15);
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
|
||||
next.belt.ori =
|
||||
Quaternion::rotation_y(ultra_slow_cos * 0.03) * Quaternion::rotation_z(0.22);
|
||||
next.belt.ori = Quaternion::rotation_y(u_slowalt * 0.03) * Quaternion::rotation_z(0.22);
|
||||
next.belt.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
@ -97,10 +103,10 @@ impl Animation for WieldAnimation {
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Sword(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-0.25, -5.0, -2.0);
|
||||
next.l_hand.offset = Vec3::new(-0.75, -1.0, -2.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
next.r_hand.offset = Vec3::new(1.25, -5.5, -5.0);
|
||||
next.r_hand.offset = Vec3::new(0.75, -1.5, -5.5);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 0.0, -3.0);
|
||||
@ -109,9 +115,9 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
|
||||
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
|
||||
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.15)
|
||||
next.control.ori = Quaternion::rotation_x(u_slow * 0.15)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(ultra_slow_cos * 0.08);
|
||||
* Quaternion::rotation_z(u_slowalt * 0.08);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
@ -131,16 +137,16 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(-0.8);
|
||||
|
||||
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.control.ori = Quaternion::rotation_x(ultra_slow_cos * 0.1 + 0.2)
|
||||
next.control.ori = Quaternion::rotation_x(u_slowalt * 0.1 + 0.2)
|
||||
* Quaternion::rotation_y(-0.3)
|
||||
* Quaternion::rotation_z(ultra_slow * 0.1 + 0.0);
|
||||
* Quaternion::rotation_z(u_slow * 0.1 + 0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Hammer(_)) => {
|
||||
next.l_hand.offset = Vec3::new(-7.0, 4.6, 7.5);
|
||||
next.l_hand.offset = Vec3::new(-7.0, 5.5, 3.5);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.3) * Quaternion::rotation_y(0.32);
|
||||
next.l_hand.scale = Vec3::one() * 1.08;
|
||||
next.r_hand.offset = Vec3::new(8.0, 5.75, 4.0);
|
||||
next.r_hand.offset = Vec3::new(8.0, 7.75, 0.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.3) * Quaternion::rotation_y(0.22);
|
||||
next.r_hand.scale = Vec3::one() * 1.06;
|
||||
next.main.offset = Vec3::new(6.0, 7.0, 0.0);
|
||||
@ -149,16 +155,16 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(1.57);
|
||||
|
||||
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.15)
|
||||
next.control.ori = Quaternion::rotation_x(u_slow * 0.15)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(ultra_slow_cos * 0.08);
|
||||
* Quaternion::rotation_z(u_slowalt * 0.08);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset = Vec3::new(1.0, -2.0, -5.0);
|
||||
next.l_hand.offset = Vec3::new(1.5, 0.5, -4.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.3);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.offset = Vec3::new(9.0, 1.0, 0.0);
|
||||
next.r_hand.offset = Vec3::new(8.0, 4.0, 2.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.8)
|
||||
* Quaternion::rotation_y(0.5)
|
||||
* Quaternion::rotation_z(-0.27);
|
||||
@ -169,9 +175,9 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(0.9);
|
||||
|
||||
next.control.offset = Vec3::new(-14.0, 1.8, 3.0);
|
||||
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2)
|
||||
next.control.ori = Quaternion::rotation_x(u_slow * 0.2)
|
||||
* Quaternion::rotation_y(-0.2)
|
||||
* Quaternion::rotation_z(ultra_slow_cos * 0.1);
|
||||
* Quaternion::rotation_z(u_slowalt * 0.1);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
@ -188,12 +194,12 @@ impl Animation for WieldAnimation {
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Bow(_)) => {
|
||||
next.l_hand.offset = Vec3::new(1.0, -4.0, -1.0);
|
||||
next.l_hand.offset = Vec3::new(2.0, 1.5, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.20)
|
||||
* Quaternion::rotation_y(-0.6)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.offset = Vec3::new(3.0, -1.0, -5.0);
|
||||
next.r_hand.offset = Vec3::new(4.0, 4.5, -5.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.20)
|
||||
* Quaternion::rotation_y(-0.6)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
@ -204,8 +210,8 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(-0.6);
|
||||
|
||||
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
|
||||
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2)
|
||||
* Quaternion::rotation_z(ultra_slow_cos * 0.1);
|
||||
next.control.ori =
|
||||
Quaternion::rotation_x(u_slow * 0.2) * Quaternion::rotation_z(u_slowalt * 0.1);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Debug(_)) => {
|
||||
@ -222,7 +228,7 @@ impl Animation for WieldAnimation {
|
||||
next.main.offset = Vec3::new(5.0, 8.75, -2.0);
|
||||
next.main.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(-1.27)
|
||||
* Quaternion::rotation_z(wave * -0.25);
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Farming(_)) => {
|
||||
@ -245,9 +251,9 @@ impl Animation for WieldAnimation {
|
||||
* Quaternion::rotation_z(0.0);
|
||||
|
||||
next.control.offset = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
|
||||
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.1)
|
||||
* Quaternion::rotation_y(0.6 + ultra_slow * 0.1)
|
||||
* Quaternion::rotation_z(ultra_slow_cos * 0.1);
|
||||
next.control.ori = Quaternion::rotation_x(u_slow * 0.1)
|
||||
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
|
||||
* Quaternion::rotation_z(u_slowalt * 0.1);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
_ => {},
|
||||
|
@ -9,6 +9,7 @@ pub struct KeyState {
|
||||
pub climb_down: bool,
|
||||
pub toggle_wield: bool,
|
||||
pub toggle_sit: bool,
|
||||
pub toggle_dance: bool,
|
||||
pub swap_loadout: bool,
|
||||
pub respawn: bool,
|
||||
pub analog_matrix: Vec2<f32>,
|
||||
@ -25,6 +26,7 @@ impl KeyState {
|
||||
climb_down: false,
|
||||
toggle_wield: false,
|
||||
toggle_sit: false,
|
||||
toggle_dance: false,
|
||||
swap_loadout: false,
|
||||
respawn: false,
|
||||
analog_matrix: Vec2::zero(),
|
||||
|
@ -151,38 +151,10 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
)),
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
if camera_mode == CameraMode::FirstPerson
|
||||
&& character_state.map(|cs| cs.is_dodge()).unwrap_or_default()
|
||||
{
|
||||
None
|
||||
} else {
|
||||
Some(humanoid_armor_hand_spec.mesh_left_hand(&body, loadout, generate_mesh))
|
||||
},
|
||||
if character_state.map(|cs| cs.is_dodge()).unwrap_or_default() {
|
||||
None
|
||||
} else {
|
||||
Some(humanoid_armor_hand_spec.mesh_right_hand(
|
||||
&body,
|
||||
loadout,
|
||||
generate_mesh,
|
||||
))
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => Some(humanoid_armor_foot_spec.mesh_left_foot(
|
||||
&body,
|
||||
loadout,
|
||||
generate_mesh,
|
||||
)),
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => Some(humanoid_armor_foot_spec.mesh_right_foot(
|
||||
&body,
|
||||
loadout,
|
||||
generate_mesh,
|
||||
)),
|
||||
CameraMode::FirstPerson => None,
|
||||
},
|
||||
Some(humanoid_armor_hand_spec.mesh_left_hand(&body, loadout, generate_mesh)),
|
||||
Some(humanoid_armor_hand_spec.mesh_right_hand(&body, loadout, generate_mesh)),
|
||||
Some(humanoid_armor_foot_spec.mesh_left_foot(&body, loadout, generate_mesh)),
|
||||
Some(humanoid_armor_foot_spec.mesh_right_foot(&body, loadout, generate_mesh)),
|
||||
match camera_mode {
|
||||
CameraMode::ThirdPerson => {
|
||||
Some(humanoid_armor_shoulder_spec.mesh_left_shoulder(
|
||||
|
@ -558,7 +558,7 @@ impl FigureMgr {
|
||||
// In air
|
||||
(false, _, false) => anim::character::JumpAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(),
|
||||
(active_tool_kind, time),
|
||||
(active_tool_kind, ori, state.last_ori, time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -566,7 +566,7 @@ impl FigureMgr {
|
||||
// Swim
|
||||
(false, _, true) => anim::character::SwimAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(),
|
||||
(active_tool_kind, vel.0, ori.magnitude(), time),
|
||||
(active_tool_kind, vel.0, ori, state.last_ori, time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -603,7 +603,13 @@ impl FigureMgr {
|
||||
} else {
|
||||
anim::character::ChargeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, vel.0.magnitude(), time),
|
||||
(
|
||||
active_tool_kind,
|
||||
vel.0.magnitude(),
|
||||
ori,
|
||||
state.last_ori,
|
||||
time,
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -721,6 +727,15 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::Dance { .. } => {
|
||||
anim::character::DanceAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(),
|
||||
(active_tool_kind, time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
_ => target_base,
|
||||
};
|
||||
|
||||
|
@ -312,6 +312,14 @@ impl PlayState for SessionState {
|
||||
self.client.borrow_mut().toggle_sit();
|
||||
}
|
||||
}
|
||||
Event::InputUpdate(GameInput::Dance, state)
|
||||
if state != self.key_state.toggle_dance =>
|
||||
{
|
||||
self.key_state.toggle_dance = state;
|
||||
if state {
|
||||
self.client.borrow_mut().toggle_dance();
|
||||
}
|
||||
}
|
||||
Event::InputUpdate(GameInput::MoveForward, state) => self.key_state.up = state,
|
||||
Event::InputUpdate(GameInput::MoveBack, state) => self.key_state.down = state,
|
||||
Event::InputUpdate(GameInput::MoveLeft, state) => self.key_state.left = state,
|
||||
|
@ -116,6 +116,7 @@ impl ControlSettings {
|
||||
GameInput::MoveRight => KeyMouse::Key(VirtualKeyCode::D),
|
||||
GameInput::Jump => KeyMouse::Key(VirtualKeyCode::Space),
|
||||
GameInput::Sit => KeyMouse::Key(VirtualKeyCode::K),
|
||||
GameInput::Dance => KeyMouse::Key(VirtualKeyCode::J),
|
||||
GameInput::Glide => KeyMouse::Key(VirtualKeyCode::LShift),
|
||||
GameInput::Climb => KeyMouse::Key(VirtualKeyCode::Space),
|
||||
GameInput::ClimbDown => KeyMouse::Key(VirtualKeyCode::LControl),
|
||||
@ -172,6 +173,7 @@ impl Default for ControlSettings {
|
||||
GameInput::MoveRight,
|
||||
GameInput::Jump,
|
||||
GameInput::Sit,
|
||||
GameInput::Dance,
|
||||
GameInput::Glide,
|
||||
GameInput::Climb,
|
||||
GameInput::ClimbDown,
|
||||
@ -273,6 +275,7 @@ pub mod con_settings {
|
||||
pub move_right: Button,
|
||||
pub jump: Button,
|
||||
pub sit: Button,
|
||||
pub dance: Button,
|
||||
pub glide: Button,
|
||||
pub climb: Button,
|
||||
pub climb_down: Button,
|
||||
@ -360,6 +363,7 @@ pub mod con_settings {
|
||||
move_right: Button::Simple(GilButton::Unknown),
|
||||
jump: Button::Simple(GilButton::South),
|
||||
sit: Button::Simple(GilButton::West),
|
||||
dance: Button::Simple(GilButton::Unknown),
|
||||
glide: Button::Simple(GilButton::LeftTrigger),
|
||||
climb: Button::Simple(GilButton::South),
|
||||
climb_down: Button::Simple(GilButton::Unknown),
|
||||
|
@ -34,6 +34,7 @@ pub enum GameInput {
|
||||
MoveRight,
|
||||
Jump,
|
||||
Sit,
|
||||
Dance,
|
||||
Glide,
|
||||
Climb,
|
||||
ClimbDown,
|
||||
@ -75,6 +76,7 @@ impl GameInput {
|
||||
GameInput::MoveBack => "gameinput.moveback",
|
||||
GameInput::Jump => "gameinput.jump",
|
||||
GameInput::Sit => "gameinput.sit",
|
||||
GameInput::Dance => "gameinput.dance",
|
||||
GameInput::Glide => "gameinput.glide",
|
||||
GameInput::Climb => "gameinput.climb",
|
||||
GameInput::ClimbDown => "gameinput.climbdown",
|
||||
|
Loading…
Reference in New Issue
Block a user