mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
anims
This commit is contained in:
parent
1ba8a6cfb3
commit
6a744eed82
@ -531,24 +531,24 @@
|
||||
),
|
||||
// Staves
|
||||
Staff("BasicStaff"): (
|
||||
vox_spec: ("weapon.staff.firestaff_starter", (-1.0, -6.0, -3.0)),
|
||||
vox_spec: ("weapon.staff.firestaff_starter", (-1.5, -3.0, -3.0)),
|
||||
color: None
|
||||
),
|
||||
Staff("BoneStaff"): (
|
||||
vox_spec: ("weapon.staff.firestaff_bone", (-1.0, -6.0, -3.0)),
|
||||
vox_spec: ("weapon.staff.firestaff_bone", (-1.5, -2.5, -3.0)),
|
||||
color: None
|
||||
),
|
||||
Staff("AmethystStaff"): (
|
||||
vox_spec: ("weapon.staff.firestaff_amethyst", (-1.0, -8.0, -4.0)),
|
||||
vox_spec: ("weapon.staff.firestaff_amethyst", (-1.5, -4.0, -4.0)),
|
||||
color: None
|
||||
),
|
||||
Staff("CultistStaff"): (
|
||||
vox_spec: ("weapon.staff.firestaff_cultist", (-2.0, -6.0, -4.0)),
|
||||
vox_spec: ("weapon.staff.firestaff_cultist", (-2.5, -2.5, -4.0)),
|
||||
color: None
|
||||
),
|
||||
// Healing staff
|
||||
Sceptre("StarterSceptre"): (
|
||||
vox_spec: ("weapon.sceptre.wood-simple", (-1.0, -6.0, -6.0)),
|
||||
vox_spec: ("weapon.sceptre.wood-simple", (-1.5, -2.5, -6.0)),
|
||||
color: None
|
||||
),
|
||||
Sceptre("Sceptre"): (
|
||||
|
BIN
assets/voxygen/voxel/weapon/staff/orc-0.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/weapon/staff/orc-0.vox
(Stored with Git LFS)
Binary file not shown.
@ -485,7 +485,7 @@ impl Tool {
|
||||
},
|
||||
Shockwave {
|
||||
energy_cost: 600,
|
||||
buildup_duration: Duration::from_millis(400),
|
||||
buildup_duration: Duration::from_millis(700),
|
||||
swing_duration: Duration::from_millis(100),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
damage: (200.0 * self.base_power()) as u32,
|
||||
|
@ -138,7 +138,10 @@ impl CharacterBehavior for Data {
|
||||
});
|
||||
update.character = CharacterState::BasicBeam(Data {
|
||||
static_data: self.static_data,
|
||||
timer: self.timer,
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
stage_section: self.stage_section,
|
||||
particle_ori: Some(*data.inputs.look_dir),
|
||||
offset: self.offset,
|
||||
|
223
voxygen/src/anim/src/character/beam.rs
Normal file
223
voxygen/src/anim/src/character/beam.rs
Normal file
@ -0,0 +1,223 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::StageSection,
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
}
|
||||
pub struct BeamAnimation;
|
||||
|
||||
impl Animation for BeamAnimation {
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
f64,
|
||||
f32,
|
||||
Option<StageSection>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_beam\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_beam")]
|
||||
#[allow(clippy::single_match)] // TODO: Pending review in #587
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let movement = (anim_time as f32 * 1.0).min(1.0);
|
||||
|
||||
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
|
||||
next.l_hand.position = Vec3::new(0.0, 0.0, -4.0);
|
||||
next.l_hand.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.position = Vec3::new(0.0, 0.0, 2.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.position = Vec3::new(0.0, 0.0, 13.2);
|
||||
next.main.orientation = Quaternion::rotation_y(3.14);
|
||||
|
||||
next.control.position = Vec3::new(-4.0, 7.0, 4.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.15)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
let slow = (anim_time as f32 * 8.0).sin();
|
||||
let slowalt = (anim_time as f32 * 8.0 + PI / 2.0).sin();
|
||||
let slowmid = (anim_time as f32 * 8.0 + PI / 4.0).sin();
|
||||
|
||||
let fast = (anim_time as f32 * 16.0).sin();
|
||||
|
||||
//println!("{:?}", anim_time);
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Buildup => {
|
||||
next.control.position = Vec3::new(
|
||||
-4.0 + movement * 16.0,
|
||||
7.0 + movement,
|
||||
4.0 + movement * 4.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(-0.3 + movement * -1.2)
|
||||
* Quaternion::rotation_y(0.15 + movement * -1.4)
|
||||
* Quaternion::rotation_z(0.0 + movement * -1.7);
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
|
||||
|
||||
next.l_hand.position = Vec3::new(
|
||||
0.0 + movement * -1.0,
|
||||
0.0 + movement * -5.0,
|
||||
-4.0 + movement * 19.0,
|
||||
);
|
||||
|
||||
if velocity < 0.5 {
|
||||
next.head.orientation = Quaternion::rotation_z(movement * -0.5);
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + movement * -3.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation = Quaternion::rotation_x(movement * -0.5)
|
||||
* Quaternion::rotation_z(movement * 0.5);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + movement * 4.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation = Quaternion::rotation_z(movement * 0.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(movement * -0.2)
|
||||
* Quaternion::rotation_z(movement * 0.5);
|
||||
next.belt.orientation = Quaternion::rotation_x(movement * 0.1)
|
||||
* Quaternion::rotation_z(movement * -0.1);
|
||||
next.shorts.orientation = Quaternion::rotation_x(movement * 0.2)
|
||||
* Quaternion::rotation_z(movement * -0.2);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
StageSection::Cast => {
|
||||
next.control.position = Vec3::new(12.0, 8.0 + slow * 2.0, 8.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-1.5)
|
||||
* Quaternion::rotation_y(-1.25 + fast * 0.07)
|
||||
* Quaternion::rotation_z(-1.7 + slowmid * 0.3);
|
||||
|
||||
next.l_hand.position = Vec3::new(
|
||||
-1.0 + slow * 3.5,
|
||||
-5.0 + slow * -2.0 + fast * -1.5,
|
||||
15.0 + slowalt * 3.5,
|
||||
);
|
||||
next.l_hand.orientation = Quaternion::rotation_x(1.57)
|
||||
* Quaternion::rotation_y(-1.1 + slowmid * -0.3)
|
||||
* Quaternion::rotation_z(-2.8);
|
||||
if velocity < 0.5 {
|
||||
next.head.orientation = Quaternion::rotation_z(-0.5 + fast * 0.05);
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 - 3.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(0.5);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + 4.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation = Quaternion::rotation_z(0.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(-0.2 + slow * 0.05)
|
||||
* Quaternion::rotation_z(0.5);
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(0.1) * Quaternion::rotation_z(-0.1);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(0.2) * Quaternion::rotation_z(-0.2);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
|
||||
StageSection::Recover => {
|
||||
next.control.position = Vec3::new(
|
||||
12.0 + movement * -16.0,
|
||||
8.0 + movement * -1.0,
|
||||
8.0 + movement * -4.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(-1.5 + movement * 1.2)
|
||||
* Quaternion::rotation_y(-1.25 + movement * 1.4)
|
||||
* Quaternion::rotation_z(-1.7 + movement * 1.7);
|
||||
next.l_hand.position = Vec3::new(
|
||||
-1.0 + movement,
|
||||
-5.0 + movement * 5.0,
|
||||
15.0 + movement * -19.0,
|
||||
);
|
||||
next.l_hand.orientation =
|
||||
Quaternion::rotation_x(1.57 + movement * -0.3)
|
||||
* Quaternion::rotation_y(-1.1 + movement * 1.1)
|
||||
* Quaternion::rotation_z(-2.8 + movement * 2.8);
|
||||
if velocity < 0.5 {
|
||||
next.head.orientation = Quaternion::rotation_z(movement * 0.5);
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 - 3.0 + movement * 3.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(-0.5 + movement * 0.5)
|
||||
* Quaternion::rotation_z(0.5 + movement * -0.5);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + 4.0 + movement * -4.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_z(0.5 + movement * -0.5);
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(-0.2 + movement * 0.2)
|
||||
* Quaternion::rotation_z(0.5 + movement * -0.5);
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(0.1 + movement * -0.1)
|
||||
* Quaternion::rotation_z(-0.1 + movement * 0.1);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(0.2 + movement * -0.2)
|
||||
* Quaternion::rotation_z(-0.2 + movement * 0.2);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
next.second.scale = match (
|
||||
active_tool_kind.map(|tk| tk.hands()),
|
||||
second_tool_kind.map(|tk| tk.hands()),
|
||||
) {
|
||||
(Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(),
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -112,8 +112,8 @@ impl Animation for ChargeAnimation {
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
-7.0 + quick * 3.5 * (1.0 / (stopa + 0.1)),
|
||||
6.0 + quicka * 3.5 * (1.0 / (stopa + 0.1)),
|
||||
6.0 - stop * 3.0,
|
||||
0.0 + quicka * 3.5 * (1.0 / (stopa + 0.1)),
|
||||
8.0 - stop * 3.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(stop * -0.2) * Quaternion::rotation_z(stop * 0.2);
|
||||
|
@ -104,25 +104,21 @@ impl Animation for EquipAnimation {
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
|
||||
next.l_hand.position = Vec3::new(1.0, -2.0, -5.0);
|
||||
next.l_hand.position = Vec3::new(0.0, 0.0, -4.0);
|
||||
next.l_hand.orientation =
|
||||
Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.3);
|
||||
Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.position = Vec3::new(9.0, 1.0, 0.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(1.8)
|
||||
* Quaternion::rotation_y(0.5)
|
||||
* Quaternion::rotation_z(-0.27);
|
||||
next.r_hand.position = Vec3::new(0.0, 0.0, 2.0);
|
||||
next.r_hand.orientation =
|
||||
Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.position = Vec3::new(11.0, 9.0, 10.0);
|
||||
next.main.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(3.14 + 0.3)
|
||||
* Quaternion::rotation_z(0.9);
|
||||
next.main.scale = Vec3::one();
|
||||
next.main.position = Vec3::new(0.0, 0.0, 13.2);
|
||||
next.main.orientation = Quaternion::rotation_y(3.14);
|
||||
|
||||
next.control.position = Vec3::new(-7.0, 6.0, 6.0);
|
||||
next.control.orientation = Quaternion::rotation_x(wave_ultra_slow * 0.2)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(wave_ultra_slow_cos * 0.1);
|
||||
next.control.position = Vec3::new(-4.0, 7.0, 4.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.15)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
|
@ -1,4 +1,5 @@
|
||||
pub mod alpha;
|
||||
pub mod beam;
|
||||
pub mod beta;
|
||||
pub mod block;
|
||||
pub mod blockidle;
|
||||
@ -16,6 +17,7 @@ pub mod leapmelee;
|
||||
pub mod repeater;
|
||||
pub mod roll;
|
||||
pub mod run;
|
||||
pub mod shockwave;
|
||||
pub mod shoot;
|
||||
pub mod sit;
|
||||
pub mod sneak;
|
||||
@ -28,13 +30,13 @@ pub mod wield;
|
||||
|
||||
// Reexports
|
||||
pub use self::{
|
||||
alpha::AlphaAnimation, beta::BetaAnimation, block::BlockAnimation,
|
||||
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, block::BlockAnimation,
|
||||
blockidle::BlockIdleAnimation, charge::ChargeAnimation, chargeswing::ChargeswingAnimation,
|
||||
climb::ClimbAnimation, dance::DanceAnimation, dash::DashAnimation, equip::EquipAnimation,
|
||||
glidewield::GlideWieldAnimation, gliding::GlidingAnimation, idle::IdleAnimation,
|
||||
jump::JumpAnimation, leapmelee::LeapAnimation, repeater::RepeaterAnimation,
|
||||
roll::RollAnimation, run::RunAnimation, shoot::ShootAnimation, sit::SitAnimation,
|
||||
sneak::SneakAnimation, spin::SpinAnimation, spinmelee::SpinMeleeAnimation,
|
||||
roll::RollAnimation, run::RunAnimation, shockwave::ShockwaveAnimation, shoot::ShootAnimation,
|
||||
sit::SitAnimation, sneak::SneakAnimation, spin::SpinAnimation, spinmelee::SpinMeleeAnimation,
|
||||
stand::StandAnimation, swim::SwimAnimation, swimwield::SwimWieldAnimation,
|
||||
wield::WieldAnimation,
|
||||
};
|
||||
|
@ -130,13 +130,18 @@ impl Animation for RunAnimation {
|
||||
next.chest.orientation = Quaternion::rotation_z(short * 0.18 * walkintensity + tilt * -0.6)
|
||||
* Quaternion::rotation_y(tilt * 1.6)
|
||||
* Quaternion::rotation_x(
|
||||
impact * 0.06 + shortalter * 0.035 + wave_stop * speed * -0.07 + (tilt.abs()),
|
||||
impact * 0.06 + shortalter * 0.035 + wave_stop * speed * -0.09 + (tilt.abs()),
|
||||
);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_z(short * 0.1 + tilt * -1.1) * Quaternion::rotation_y(tilt * 0.5);
|
||||
next.belt.position = Vec3::new(
|
||||
0.0,
|
||||
0.25 + skeleton_attr.belt.0,
|
||||
0.25 + skeleton_attr.belt.1,
|
||||
);
|
||||
next.belt.orientation = Quaternion::rotation_x(0.1)
|
||||
* Quaternion::rotation_z(short * 0.1 + tilt * -1.1)
|
||||
* Quaternion::rotation_y(tilt * 0.5);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
@ -144,9 +149,14 @@ impl Animation for RunAnimation {
|
||||
Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_z(short * 0.25 + tilt * -1.5) * Quaternion::rotation_y(tilt * 0.7);
|
||||
next.shorts.position = Vec3::new(
|
||||
0.0,
|
||||
0.65 + skeleton_attr.shorts.0,
|
||||
0.65 + skeleton_attr.shorts.1,
|
||||
);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.2)
|
||||
* Quaternion::rotation_z(short * 0.25 + tilt * -1.5)
|
||||
* Quaternion::rotation_y(tilt * 0.7);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.position = Vec3::new(
|
||||
|
192
voxygen/src/anim/src/character/shockwave.rs
Normal file
192
voxygen/src/anim/src/character/shockwave.rs
Normal file
@ -0,0 +1,192 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::StageSection,
|
||||
};
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
}
|
||||
pub struct ShockwaveAnimation;
|
||||
|
||||
impl Animation for ShockwaveAnimation {
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
f64,
|
||||
f32,
|
||||
Option<StageSection>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_shockwave\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_shockwave")]
|
||||
#[allow(clippy::single_match)] // TODO: Pending review in #587
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let movement = (anim_time as f32 * 1.0).min(1.0);
|
||||
|
||||
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
|
||||
next.l_hand.position = Vec3::new(0.0, 0.0, -4.0);
|
||||
next.l_hand.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.position = Vec3::new(0.0, 0.0, 2.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.position = Vec3::new(0.0, 0.0, 13.2);
|
||||
next.main.orientation = Quaternion::rotation_y(3.14);
|
||||
|
||||
next.control.position = Vec3::new(-4.0, 7.0, 4.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.15)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
let twist = movement * 0.8;
|
||||
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Buildup => {
|
||||
next.control.position = Vec3::new(
|
||||
-4.0 + movement * 5.0,
|
||||
7.0 + movement * 3.0,
|
||||
4.0 + movement * 10.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(-0.3 + movement * 0.8)
|
||||
* Quaternion::rotation_y(0.15 + movement * -0.15)
|
||||
* Quaternion::rotation_z(movement * 0.8);
|
||||
next.head.orientation = Quaternion::rotation_x(movement * 0.4)
|
||||
* Quaternion::rotation_z(twist * 0.2);
|
||||
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + movement * 2.0,
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_z(twist * -0.2);
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_z(twist * 0.6);
|
||||
|
||||
next.shorts.orientation = Quaternion::rotation_z(twist);
|
||||
|
||||
if velocity < 0.5 {
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + movement * -7.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation = Quaternion::rotation_x(movement * -0.8)
|
||||
* Quaternion::rotation_z(movement * 0.3);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + movement * 5.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation = Quaternion::rotation_y(movement * -0.3)
|
||||
* Quaternion::rotation_z(movement * 0.4);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
StageSection::Swing => {
|
||||
next.control.position = Vec3::new(1.0, 10.0, 14.0 + movement * -2.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.5 + movement * 0.3)
|
||||
* Quaternion::rotation_y(movement * 0.3)
|
||||
* Quaternion::rotation_z(0.8 + movement * -0.8);
|
||||
|
||||
next.head.orientation = Quaternion::rotation_x(0.4)
|
||||
* Quaternion::rotation_z(0.2 + movement * -0.8);
|
||||
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + 2.0 + movement * -4.0,
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_x(movement * -0.8)
|
||||
* Quaternion::rotation_z(movement * -0.3);
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_x(movement * 0.2)
|
||||
* Quaternion::rotation_z(0.48 + movement * -0.48);
|
||||
|
||||
next.shorts.orientation = Quaternion::rotation_x(movement * 0.3)
|
||||
* Quaternion::rotation_z(0.8 + movement * -0.8);
|
||||
if velocity < 0.5 {
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 - 7.0 + movement * 7.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(-0.8 + movement * 0.8)
|
||||
* Quaternion::rotation_z(0.3 + movement * -0.3);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + 5.0 + movement * -5.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_y(-0.3 + movement * 0.3)
|
||||
* Quaternion::rotation_z(0.4 + movement * -0.4);
|
||||
} else {
|
||||
};
|
||||
},
|
||||
StageSection::Recover => {
|
||||
next.control.position = Vec3::new(
|
||||
1.0 + movement * -5.0,
|
||||
10.0 + movement * -3.0,
|
||||
12.0 + movement * -8.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(0.8 + movement * -1.1)
|
||||
* Quaternion::rotation_y(movement * -0.15)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.head.orientation = Quaternion::rotation_x(0.4 + movement * -0.4)
|
||||
* Quaternion::rotation_z(-0.6 + movement * 0.6);
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_x(0.2 + movement * -0.2);
|
||||
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.3 + movement * -0.3);
|
||||
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 - 2.0 + movement * 2.0,
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_x(-0.8 + movement * 0.8)
|
||||
* Quaternion::rotation_z(-0.3 + movement * 0.3);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
next.second.scale = match (
|
||||
active_tool_kind.map(|tk| tk.hands()),
|
||||
second_tool_kind.map(|tk| tk.hands()),
|
||||
) {
|
||||
(Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(),
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul};
|
||||
pub struct WieldAnimation;
|
||||
|
||||
impl Animation for WieldAnimation {
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -25,6 +25,7 @@ impl Animation for WieldAnimation {
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let lab = 1.0;
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
|
||||
let mut next = (*skeleton).clone();
|
||||
let head_look = Vec2::new(
|
||||
@ -40,6 +41,14 @@ impl Animation for WieldAnimation {
|
||||
* 0.1,
|
||||
);
|
||||
|
||||
let footrotl = (((1.0)
|
||||
/ (0.5
|
||||
+ (0.5)
|
||||
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin());
|
||||
let foothoril = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.45).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();
|
||||
@ -52,7 +61,7 @@ impl Animation for WieldAnimation {
|
||||
let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin();
|
||||
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
|
||||
|
||||
if velocity > 0.5 {
|
||||
if speed > 0.5 {
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.orientation = Quaternion::rotation_x(-0.2);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
@ -162,7 +171,7 @@ impl Animation for WieldAnimation {
|
||||
next.r_control.position = Vec3::new(7.0, 0.0, 0.0);
|
||||
},
|
||||
Some(ToolKind::Axe(_)) => {
|
||||
if velocity < 0.5 {
|
||||
if speed < 0.5 {
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
-3.5 + skeleton_attr.head.0,
|
||||
@ -229,21 +238,33 @@ impl Animation for WieldAnimation {
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
|
||||
next.l_hand.position = Vec3::new(11.0, 5.0, -4.0);
|
||||
if speed > 0.5 && velocity.z == 0.0 {
|
||||
next.r_hand.position = Vec3::new(
|
||||
4.0 + skeleton_attr.hand.0 + foothoril * 1.3,
|
||||
-2.0 + skeleton_attr.hand.1 + foothoril * -6.5,
|
||||
-2.0 + skeleton_attr.hand.2 - foothoril * 7.0,
|
||||
);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2)
|
||||
* Quaternion::rotation_y(footrotl * -0.4);
|
||||
} else {
|
||||
next.r_hand.position = Vec3::new(0.0, 0.0, 2.0);
|
||||
next.r_hand.orientation =
|
||||
Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2);
|
||||
};
|
||||
next.control.position = Vec3::new(-4.0, 7.0, 4.0);
|
||||
|
||||
next.l_hand.position = Vec3::new(0.0, 0.0, -4.0);
|
||||
next.l_hand.orientation =
|
||||
Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.position = Vec3::new(12.0, 5.5, 2.0);
|
||||
next.r_hand.orientation =
|
||||
Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2);
|
||||
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.position = Vec3::new(12.0, 8.5, 13.2);
|
||||
next.main.position = Vec3::new(0.0, 0.0, 13.2);
|
||||
next.main.orientation = Quaternion::rotation_y(3.14);
|
||||
|
||||
next.control.position = Vec3::new(-18.0, 1.0, 6.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.3 + u_slow * 0.1)
|
||||
* Quaternion::rotation_y(0.15)
|
||||
* Quaternion::rotation_z(u_slowalt * 0.08);
|
||||
* Quaternion::rotation_z(u_slowalt * 0.1);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Shield(_)) => {
|
||||
@ -317,7 +338,7 @@ impl Animation for WieldAnimation {
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
},
|
||||
Some(ToolKind::Farming(_)) => {
|
||||
if velocity < 0.5 {
|
||||
if speed < 0.5 {
|
||||
next.head.orientation = Quaternion::rotation_z(head_look.x)
|
||||
* Quaternion::rotation_x(-0.2 + head_look.y.abs());
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
@ -126,9 +126,9 @@ impl<'a> SlotKey<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
|
||||
_ => None,
|
||||
}
|
||||
.map(|image_key| match image_key {
|
||||
HotbarImage::Fireball => (
|
||||
HotbarImage::FireAoe => (
|
||||
image_key,
|
||||
(energy.current() < 450).then_some(Color::Rgba(0.3, 0.3, 0.3, 0.8)),
|
||||
(energy.current() < 600).then_some(Color::Rgba(0.3, 0.3, 0.3, 0.8)),
|
||||
),
|
||||
HotbarImage::HammerLeap => (
|
||||
image_key,
|
||||
|
@ -991,6 +991,34 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::Shockwave(s) => {
|
||||
let stage_time = s.timer.as_secs_f64();
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Swing => {
|
||||
stage_time / s.static_data.swing_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Recover => {
|
||||
stage_time / s.static_data.recover_duration.as_secs_f64()
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::character::ShockwaveAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
time,
|
||||
vel.0.magnitude(),
|
||||
Some(s.stage_section),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::LeapMelee(s) => {
|
||||
let stage_progress = match active_tool_kind {
|
||||
Some(ToolKind::Axe(_) | ToolKind::Hammer(_)) => {
|
||||
@ -1067,18 +1095,28 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::BasicBeam(_) => {
|
||||
anim::character::ChargeAnimation::update_skeleton(
|
||||
CharacterState::BasicBeam(s) => {
|
||||
let stage_time = s.timer.as_secs_f64();
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Cast => s.timer.as_secs_f64(),
|
||||
StageSection::Recover => {
|
||||
stage_time / s.static_data.recover_duration.as_secs_f64()
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::character::BeamAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0.magnitude(),
|
||||
ori,
|
||||
state.last_ori,
|
||||
time,
|
||||
vel.0.magnitude(),
|
||||
Some(s.stage_section),
|
||||
),
|
||||
state.state_time,
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
@ -1188,7 +1226,7 @@ impl FigureMgr {
|
||||
} else {
|
||||
anim::character::WieldAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
|
||||
(active_tool_kind, second_tool_kind, vel.0, time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
|
Loading…
Reference in New Issue
Block a user