mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
anims
This commit is contained in:
parent
fadba23dde
commit
28eb58ddfa
@ -260,8 +260,8 @@ impl Tool {
|
||||
range: 3.5,
|
||||
max_angle: 30.0,
|
||||
charge_duration: Duration::from_millis(1200),
|
||||
swing_duration: Duration::from_millis(100),
|
||||
recover_duration: Duration::from_millis(500),
|
||||
swing_duration: Duration::from_millis(400),
|
||||
recover_duration: Duration::from_millis(600),
|
||||
},
|
||||
LeapMelee {
|
||||
energy_cost: 0,
|
||||
@ -327,10 +327,10 @@ impl Tool {
|
||||
},
|
||||
RepeaterRanged {
|
||||
energy_cost: 0,
|
||||
movement_duration: Duration::from_millis(200),
|
||||
buildup_duration: Duration::from_millis(100),
|
||||
shoot_duration: Duration::from_millis(100),
|
||||
recover_duration: Duration::from_millis(500),
|
||||
movement_duration: Duration::from_millis(300),
|
||||
buildup_duration: Duration::from_millis(200),
|
||||
shoot_duration: Duration::from_millis(200),
|
||||
recover_duration: Duration::from_millis(800),
|
||||
leap: Some(10.0),
|
||||
projectile: Projectile {
|
||||
hit_solid: vec![projectile::Effect::Stick],
|
||||
|
@ -107,7 +107,7 @@ pub fn forward_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32,
|
||||
|
||||
pub fn handle_orientation(data: &JoinData, update: &mut StateUpdate, rate: f32) {
|
||||
// Set direction based on move direction
|
||||
let ori_dir = if update.character.is_attack() | update.character.is_block() {
|
||||
let ori_dir = if update.character.is_block() {
|
||||
data.inputs.look_dir.xy()
|
||||
} else if !data.inputs.move_dir.is_approx_zero() {
|
||||
data.inputs.move_dir
|
||||
|
288
voxygen/src/anim/src/character/chargeswing.rs
Normal file
288
voxygen/src/anim/src/character/chargeswing.rs
Normal file
@ -0,0 +1,288 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::StageSection,
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
pub struct ChargeswingAnimation;
|
||||
|
||||
impl Animation for ChargeswingAnimation {
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
Option<StageSection>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_chargeswing\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_chargeswing")]
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, second_tool_kind, velocity, _global_time, stage_section): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
|
||||
let lab = 1.0;
|
||||
|
||||
// Spin stuff here
|
||||
let foot = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 10.32).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 10.32).sin());
|
||||
|
||||
let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin();
|
||||
|
||||
let spin = (anim_time as f32 * 2.8 * lab as f32).sin();
|
||||
let spinhalf = (anim_time as f32 * 1.4 * lab as f32).sin();
|
||||
let short = (((5.0)
|
||||
/ (1.5
|
||||
+ 3.5 * ((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());
|
||||
// end spin stuff
|
||||
|
||||
let movement = (anim_time as f32 * 1.0);
|
||||
let fire = (anim_time as f32 * 18.0 * lab as f32).sin();
|
||||
|
||||
let foothoril = (anim_time as f32 * 8.0 * lab as f32 + PI * 1.45).sin();
|
||||
let foothorir = (anim_time as f32 * 8.0 * lab as f32 + PI * (0.45)).sin();
|
||||
|
||||
let footvertl = (anim_time as f32 * 8.0 * lab as f32).sin();
|
||||
let footvertr = (anim_time as f32 * 8.0 * lab as f32 + PI).sin();
|
||||
let footrotl = (((1.0)
|
||||
/ (0.5
|
||||
+ (0.5)
|
||||
* ((anim_time as f32 * 8.0 * lab as f32 + PI * 1.4).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 8.0 * lab as f32 + PI * 1.4).sin());
|
||||
|
||||
let footrotr = (((1.0)
|
||||
/ (0.5
|
||||
+ (0.5)
|
||||
* ((anim_time as f32 * 8.0 * lab as f32 + PI * 0.4).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 8.0* lab as f32 + PI * 0.4).sin());
|
||||
if let Some(ToolKind::Hammer(_)) = active_tool_kind {
|
||||
next.l_hand.position = Vec3::new(-12.0, 0.0, 0.0);
|
||||
next.l_hand.orientation =
|
||||
Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.08;
|
||||
next.r_hand.position = Vec3::new(2.0, 0.0, 0.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
next.r_hand.scale = Vec3::one() * 1.06;
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
|
||||
|
||||
next.control.position = Vec3::new(6.0, 7.0, 1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Charge => {
|
||||
next.control.position = Vec3::new(6.0+(movement*-4.0).max(-8.0), 7.0+(movement*2.0).min(2.0), 1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.3)
|
||||
* Quaternion::rotation_y(0.0+(movement*0.7).min(0.7)+fire*0.1*(anim_time as f32).min(2.0))
|
||||
* Quaternion::rotation_z(0.0+(movement*0.2).min(0.5));
|
||||
|
||||
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_z((movement*2.0).min(PI/2.0));
|
||||
next.shorts.orientation = Quaternion::rotation_z((short*0.25+movement*-1.0).max(-PI/4.0));
|
||||
|
||||
next.head.position = Vec3::new(0.0, skeleton_attr.head.0-2.0+(movement*2.0).min(2.0), skeleton_attr.head.1);
|
||||
|
||||
next.head.orientation = Quaternion::rotation_z((movement*-1.8).max(PI/-2.0));
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_z(short * 0.25);
|
||||
//next.l_foot.orientation =
|
||||
//Quaternion::rotation_x((movement*-0.2).max(-0.5))*Quaternion::rotation_z((movement*0.7).min(0.7));
|
||||
//next.r_foot.orientation =
|
||||
//Quaternion::rotation_x((movement*-0.2).max(-0.5))*Quaternion::rotation_z((movement*0.7).min(0.7));
|
||||
if speed > 0.5{
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
-1.5 + skeleton_attr.foot.1 + foothoril * -3.5-2.0,
|
||||
2.0 + skeleton_attr.foot.2 + ((footvertl * -1.7).max(-1.0)),
|
||||
);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
-1.5 + skeleton_attr.foot.1 + foothorir * -3.5+5.0,
|
||||
2.0 + skeleton_attr.foot.2 + ((footvertr * -1.7).max(-1.0)),
|
||||
);
|
||||
|
||||
next.l_foot.orientation = Quaternion::rotation_x(-0.4 + footrotl * -0.2)
|
||||
* Quaternion::rotation_z((movement*0.5).min(0.5));
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.orientation = Quaternion::rotation_x(-0.4 + footrotr * -0.2)
|
||||
* Quaternion::rotation_z((movement*0.5).min(0.5));
|
||||
}
|
||||
else{
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1-5.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1+7.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
|
||||
next.l_foot.orientation = Quaternion::rotation_x(-0.2);
|
||||
|
||||
next.r_foot.orientation = Quaternion::rotation_x(0.2);
|
||||
|
||||
|
||||
};
|
||||
|
||||
},
|
||||
|
||||
StageSection::Swing => {
|
||||
next.chest.orientation = Quaternion::rotation_z(-0.5);
|
||||
next.control.position = Vec3::new(6.0, 7.0, 1.0+3.0);
|
||||
next.control.orientation = Quaternion::rotation_x(PI/2.0)
|
||||
* Quaternion::rotation_y(-1.6)
|
||||
* Quaternion::rotation_z(-0.1);
|
||||
next.head.orientation = Quaternion::rotation_z(0.4);
|
||||
|
||||
},
|
||||
StageSection::Recover => {
|
||||
next.chest.orientation = Quaternion::rotation_z(-0.5+movement*0.5);
|
||||
next.control.position = Vec3::new(6.0, 7.0, 1.0+3.0+movement*-3.0);
|
||||
next.control.orientation = Quaternion::rotation_x(PI/2.0)
|
||||
* Quaternion::rotation_y(-1.6+movement*1.6)
|
||||
* Quaternion::rotation_z(-0.1+movement*0.1);
|
||||
next.head.orientation = Quaternion::rotation_z(0.4+movement*-0.4);
|
||||
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if let Some(ToolKind::Hammer(_)) = active_tool_kind {
|
||||
next.l_hand.position = Vec3::new(-12.0, 0.0, 0.0);
|
||||
next.l_hand.orientation = Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.08;
|
||||
next.r_hand.position = Vec3::new(3.0, 0.0, 0.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
next.r_hand.scale = Vec3::one() * 1.06;
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(-1.57)
|
||||
* Quaternion::rotation_z(1.57);
|
||||
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
-2.0 + skeleton_attr.head.0 + slower * -1.0,
|
||||
skeleton_attr.head.1,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_z(slower * 0.05)
|
||||
* Quaternion::rotation_x((slowersmooth * -0.25 + slower * 0.55).max(-0.2))
|
||||
* Quaternion::rotation_y(slower * 0.05);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.position = Vec3::new(0.0, 0.0, 7.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(slower * 0.08 + slowersmooth * 0.15)
|
||||
* Quaternion::rotation_x(-0.3 + slower * 0.45 + slowersmooth * 0.26)
|
||||
* Quaternion::rotation_y(slower * 0.18 + slowersmooth * 0.15);
|
||||
|
||||
next.belt.position = Vec3::new(0.0, 0.0, -2.0 + slower * -0.7);
|
||||
next.belt.orientation = Quaternion::rotation_z(slower * -0.16 + slowersmooth * -0.12)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.06)
|
||||
* Quaternion::rotation_y(slower * -0.05);
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, 0.0, -5.0 + slower * -0.7);
|
||||
next.shorts.orientation = Quaternion::rotation_z(slower * -0.08 + slowersmooth * -0.08)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.08 + slowersmooth * -0.08)
|
||||
* Quaternion::rotation_y(slower * -0.07);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(slower * -0.7 + 0.4) * Quaternion::rotation_y(slower * 0.4);
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
slower * 3.0 + slowersmooth * -6.0 - 2.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(slower * -0.2 + slowersmooth * -0.3 - 0.2);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
slower * 2.0 + slowersmooth * -4.0 - 1.0,
|
||||
-2.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_x(slower * -0.4 + slowersmooth * -0.6 - 1.0);
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.7 + slower * 1.5)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.4 + slowersmooth * -0.4 + slower * 0.2);
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.lantern.position = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
next.l_control.scale = Vec3::one();
|
||||
next.r_control.scale = Vec3::one();
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
*/
|
||||
|
||||
|
||||
//next.lantern.position = Vec3::new(
|
||||
// skeleton_attr.lantern.0,
|
||||
// skeleton_attr.lantern.1,
|
||||
// skeleton_attr.lantern.2,
|
||||
//);
|
||||
//next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
//next.glider.scale = Vec3::one() * 0.0;
|
||||
//next.l_control.scale = Vec3::one();
|
||||
//next.r_control.scale = Vec3::one();
|
||||
|
||||
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.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
//next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
//next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
next
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ pub mod beta;
|
||||
pub mod block;
|
||||
pub mod blockidle;
|
||||
pub mod charge;
|
||||
pub mod chargeswing;
|
||||
pub mod climb;
|
||||
pub mod dance;
|
||||
pub mod dash;
|
||||
@ -12,6 +13,7 @@ pub mod gliding;
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod leapmelee;
|
||||
pub mod repeater;
|
||||
pub mod roll;
|
||||
pub mod run;
|
||||
pub mod shoot;
|
||||
@ -27,10 +29,10 @@ pub mod wield;
|
||||
// Reexports
|
||||
pub use self::{
|
||||
alpha::AlphaAnimation, beta::BetaAnimation, block::BlockAnimation,
|
||||
blockidle::BlockIdleAnimation, charge::ChargeAnimation, climb::ClimbAnimation,
|
||||
blockidle::BlockIdleAnimation, charge::ChargeAnimation, chargeswing::ChargeswingAnimation, climb::ClimbAnimation,
|
||||
dance::DanceAnimation, dash::DashAnimation, equip::EquipAnimation,
|
||||
glidewield::GlideWieldAnimation, gliding::GlidingAnimation, idle::IdleAnimation,
|
||||
jump::JumpAnimation, leapmelee::LeapAnimation, roll::RollAnimation, run::RunAnimation,
|
||||
jump::JumpAnimation, leapmelee::LeapAnimation, repeater::RepeaterAnimation, roll::RollAnimation, run::RunAnimation,
|
||||
shoot::ShootAnimation, sit::SitAnimation, sneak::SneakAnimation, spin::SpinAnimation,
|
||||
spinmelee::SpinMeleeAnimation, stand::StandAnimation, swim::SwimAnimation,
|
||||
swimwield::SwimWieldAnimation, wield::WieldAnimation,
|
||||
|
318
voxygen/src/anim/src/character/repeater.rs
Normal file
318
voxygen/src/anim/src/character/repeater.rs
Normal file
@ -0,0 +1,318 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::StageSection,
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
pub struct RepeaterAnimation;
|
||||
|
||||
impl Animation for RepeaterAnimation {
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
Option<StageSection>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_repeater\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_repeater")]
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 1.0;
|
||||
|
||||
// Spin stuff here
|
||||
let foot = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 10.32).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 10.32).sin());
|
||||
|
||||
let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin();
|
||||
|
||||
let spin = (anim_time as f32 * 2.8 * lab as f32).sin();
|
||||
let spinhalf = (anim_time as f32 * 1.4 * lab as f32).sin();
|
||||
|
||||
// end spin stuff
|
||||
|
||||
let movement = (anim_time as f32 * 1.0).min(1.0);
|
||||
let fire = (anim_time as f32 * 18.0 * lab as f32).sin();
|
||||
|
||||
|
||||
if let Some(ToolKind::Bow(_)) = active_tool_kind {
|
||||
next.l_hand.position = Vec3::new(2.0, 1.5, 0.0);
|
||||
next.l_hand.orientation = 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.position = Vec3::new(5.9, 4.5, -5.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(1.20)
|
||||
* Quaternion::rotation_y(-0.6)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.position = Vec3::new(3.0, 2.0, -13.0);
|
||||
next.main.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.3)
|
||||
* Quaternion::rotation_z(-0.6);
|
||||
|
||||
next.hold.position = Vec3::new(1.2, -1.0, -5.2);
|
||||
next.hold.orientation = Quaternion::rotation_x(-1.7)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(-0.1);
|
||||
next.hold.scale = Vec3::one() * 1.0;
|
||||
|
||||
next.control.position = Vec3::new(-7.0, 6.0, 6.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Movement => {
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0+movement*-1.5-1.5,
|
||||
skeleton_attr.foot.1+movement*4.0+4.0,
|
||||
skeleton_attr.foot.2+movement*2.5+2.5,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(movement*0.75+0.75)*Quaternion::rotation_z(movement*0.3+0.3);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0+movement*1.5+1.5,
|
||||
skeleton_attr.foot.1+movement*4.0+4.0,
|
||||
skeleton_attr.foot.2+movement*2.5+2.5,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_x(movement*0.75+0.75)*Quaternion::rotation_z(movement*-0.3-0.3);
|
||||
next.shorts.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.shorts.0+movement*4.0,
|
||||
skeleton_attr.shorts.1+movement*1.0,
|
||||
);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(movement*0.6);
|
||||
next.belt.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.belt.0+movement*2.0,
|
||||
skeleton_attr.belt.1,
|
||||
);
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(movement*0.2);
|
||||
next.control.position = Vec3::new(-7.0+movement*5.0, 6.0+movement*3.0, 6.0+movement*1.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(movement*0.4)*Quaternion::rotation_y(movement*0.8);
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_y(movement*0.15);
|
||||
next.torso.orientation =
|
||||
Quaternion::rotation_x(movement*0.1)
|
||||
},
|
||||
|
||||
StageSection::Buildup => {
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0-3.0,
|
||||
skeleton_attr.foot.1+8.0,
|
||||
skeleton_attr.foot.2+5.0,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(1.5+movement*-0.2)*Quaternion::rotation_z(0.6);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0+3.0,
|
||||
skeleton_attr.foot.1+8.0,
|
||||
skeleton_attr.foot.2+5.0,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_x(1.5+movement*-0.2)*Quaternion::rotation_z(-0.6);
|
||||
next.shorts.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.shorts.0+4.0,
|
||||
skeleton_attr.shorts.1+1.0,
|
||||
);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(0.6);
|
||||
next.belt.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.belt.0+2.0,
|
||||
skeleton_attr.belt.1,
|
||||
);
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(0.2);
|
||||
next.control.position = Vec3::new(-2.0, 9.0, 7.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(0.4)*Quaternion::rotation_y(0.8);
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_y(0.15+movement*0.05);
|
||||
next.torso.orientation =
|
||||
Quaternion::rotation_x(0.1+movement*0.1);
|
||||
},
|
||||
|
||||
StageSection::Shoot => {
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0-3.0,
|
||||
skeleton_attr.foot.1+8.0,
|
||||
skeleton_attr.foot.2+5.0,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(1.3)*Quaternion::rotation_z(0.6);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0+3.0,
|
||||
skeleton_attr.foot.1+8.0,
|
||||
skeleton_attr.foot.2+5.0,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_x(1.3)*Quaternion::rotation_z(-0.6);
|
||||
next.shorts.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.shorts.0+4.0,
|
||||
skeleton_attr.shorts.1+1.0,
|
||||
);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(0.6);
|
||||
next.belt.position = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.belt.0+2.0,
|
||||
skeleton_attr.belt.1,
|
||||
);
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(0.2);
|
||||
next.control.position = Vec3::new(-2.0, 9.0, 7.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(0.4)*Quaternion::rotation_y(0.8);
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_y(0.2);
|
||||
next.torso.orientation =
|
||||
Quaternion::rotation_x(0.2+movement*0.15);
|
||||
|
||||
|
||||
next.l_hand.position = Vec3::new(2.0+fire*-6.0-3.0, 1.5+fire*-6.0-3.0, 0.0);
|
||||
next.l_hand.orientation = Quaternion::rotation_x(1.20)
|
||||
* Quaternion::rotation_y(-0.6)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
},
|
||||
StageSection::Recover => {
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if let Some(ToolKind::Hammer(_)) = active_tool_kind {
|
||||
next.l_hand.position = Vec3::new(-12.0, 0.0, 0.0);
|
||||
next.l_hand.orientation = Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.08;
|
||||
next.r_hand.position = Vec3::new(3.0, 0.0, 0.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
next.r_hand.scale = Vec3::one() * 1.06;
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(-1.57)
|
||||
* Quaternion::rotation_z(1.57);
|
||||
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
-2.0 + skeleton_attr.head.0 + slower * -1.0,
|
||||
skeleton_attr.head.1,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_z(slower * 0.05)
|
||||
* Quaternion::rotation_x((slowersmooth * -0.25 + slower * 0.55).max(-0.2))
|
||||
* Quaternion::rotation_y(slower * 0.05);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.position = Vec3::new(0.0, 0.0, 7.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(slower * 0.08 + slowersmooth * 0.15)
|
||||
* Quaternion::rotation_x(-0.3 + slower * 0.45 + slowersmooth * 0.26)
|
||||
* Quaternion::rotation_y(slower * 0.18 + slowersmooth * 0.15);
|
||||
|
||||
next.belt.position = Vec3::new(0.0, 0.0, -2.0 + slower * -0.7);
|
||||
next.belt.orientation = Quaternion::rotation_z(slower * -0.16 + slowersmooth * -0.12)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.06)
|
||||
* Quaternion::rotation_y(slower * -0.05);
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, 0.0, -5.0 + slower * -0.7);
|
||||
next.shorts.orientation = Quaternion::rotation_z(slower * -0.08 + slowersmooth * -0.08)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.08 + slowersmooth * -0.08)
|
||||
* Quaternion::rotation_y(slower * -0.07);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(slower * -0.7 + 0.4) * Quaternion::rotation_y(slower * 0.4);
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
slower * 3.0 + slowersmooth * -6.0 - 2.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(slower * -0.2 + slowersmooth * -0.3 - 0.2);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
slower * 2.0 + slowersmooth * -4.0 - 1.0,
|
||||
-2.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_x(slower * -0.4 + slowersmooth * -0.6 - 1.0);
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.7 + slower * 1.5)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.4 + slowersmooth * -0.4 + slower * 0.2);
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.lantern.position = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
next.l_control.scale = Vec3::one();
|
||||
next.r_control.scale = Vec3::one();
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
*/
|
||||
|
||||
|
||||
//next.lantern.position = Vec3::new(
|
||||
// skeleton_attr.lantern.0,
|
||||
// skeleton_attr.lantern.1,
|
||||
// skeleton_attr.lantern.2,
|
||||
//);
|
||||
//next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
//next.glider.scale = Vec3::one() * 0.0;
|
||||
//next.l_control.scale = Vec3::one();
|
||||
//next.r_control.scale = Vec3::one();
|
||||
|
||||
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.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
//next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
//next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
next
|
||||
}
|
||||
}
|
@ -848,37 +848,38 @@ impl FigureMgr {
|
||||
)
|
||||
}
|
||||
},
|
||||
CharacterState::ChargedMelee(data) => {
|
||||
if data.exhausted {
|
||||
anim::character::AlphaAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0.magnitude(),
|
||||
time,
|
||||
None,
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
} else {
|
||||
anim::character::ChargeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0.magnitude(),
|
||||
ori,
|
||||
state.last_ori,
|
||||
time,
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
}
|
||||
CharacterState::ChargedMelee(s) => {
|
||||
let stage_time = s.timer.as_secs_f64();
|
||||
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Charge => {
|
||||
stage_time
|
||||
/ s.static_data.charge_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,
|
||||
_ => state.state_time,
|
||||
};
|
||||
|
||||
anim::character::ChargeswingAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0,
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::ChargedRanged(data) => {
|
||||
if data.exhausted {
|
||||
@ -906,31 +907,42 @@ impl FigureMgr {
|
||||
)
|
||||
}
|
||||
},
|
||||
CharacterState::RepeaterRanged(data) => {
|
||||
if data.reps_remaining > 0 {
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
} else {
|
||||
anim::character::ChargeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0.magnitude(),
|
||||
ori,
|
||||
state.last_ori,
|
||||
time,
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
}
|
||||
CharacterState::RepeaterRanged(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::Movement => {
|
||||
stage_time
|
||||
/ s.static_data.movement_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Shoot => {
|
||||
stage_time / s.static_data.shoot_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Recover => {
|
||||
stage_time
|
||||
/ s.static_data.recover_duration.as_secs_f64()
|
||||
},
|
||||
_ => 0.0,
|
||||
_ => state.state_time,
|
||||
};
|
||||
|
||||
anim::character::RepeaterAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0,
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::Sneak { .. } => {
|
||||
anim::character::SneakAnimation::update_skeleton(
|
||||
|
Loading…
Reference in New Issue
Block a user