This commit is contained in:
jshipsey 2020-10-03 02:19:43 -04:00 committed by jiminycrick
parent 28eb58ddfa
commit 521ffd64ba
6 changed files with 245 additions and 543 deletions

View File

@ -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_block() {
let ori_dir = if update.character.is_attack() | update.character.is_block() {
data.inputs.look_dir.xy()
} else if !data.inputs.move_dir.is_approx_zero() {
data.inputs.move_dir

View File

@ -37,24 +37,13 @@ impl Animation for ChargeswingAnimation {
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)))
/ (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 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();
@ -65,213 +54,131 @@ impl Animation for ChargeswingAnimation {
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)))
* ((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)))
* ((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());
* ((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.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();
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.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.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.belt.orientation =
Quaternion::rotation_z((short * 0.08 + movement * -1.0).max(-PI / 5.0));
next.shorts.orientation =
Quaternion::rotation_z((short * 0.15 + 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.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.head.orientation =
Quaternion::rotation_z((movement * -1.8).max(PI / -2.0));
next.belt.orientation = Quaternion::rotation_z(short * 0.05);
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.shorts.orientation = Quaternion::rotation_z(short * 0.15);
if speed > 0.5 {
next.l_foot.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * -2.5 - 3.5,
2.0 + skeleton_attr.foot.2 + ((footvertl * -1.2).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.r_foot.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * -2.5 + 6.0,
2.0 + skeleton_attr.foot.2 + ((footvertr * -1.2).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.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.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.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.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);
};
next.l_foot.orientation =
Quaternion::rotation_x(-0.2) * Quaternion::rotation_z(0.5);
next.r_foot.orientation =
Quaternion::rotation_x(0.2) * Quaternion::rotation_z(0.5);
};
},
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);
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.8);
next.l_hand.position = Vec3::new(-3.0, 0.0, 0.0);
},
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);
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.8 + movement * -0.8);
next.l_hand.position = Vec3::new(-3.0 + movement * -9.0, 0.0, 0.0);
},
_ => {},
}
}
}
/* 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()),

View File

@ -161,85 +161,6 @@ impl Animation for LeapAnimation {
_ => {},
}
}
/* 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;
*/
} else if let Some(ToolKind::Axe(_)) = active_tool_kind {
//INTENTION: SWORD
next.l_hand.position = Vec3::new(-0.75, -1.0, -2.5);

View File

@ -29,13 +29,14 @@ pub mod wield;
// Reexports
pub use self::{
alpha::AlphaAnimation, beta::BetaAnimation, block::BlockAnimation,
blockidle::BlockIdleAnimation, charge::ChargeAnimation, chargeswing::ChargeswingAnimation, climb::ClimbAnimation,
dance::DanceAnimation, dash::DashAnimation, equip::EquipAnimation,
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, stand::StandAnimation, swim::SwimAnimation,
swimwield::SwimWieldAnimation, wield::WieldAnimation,
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,
};
use super::{make_bone, vek::*, FigureBoneData, Skeleton};

View File

@ -6,7 +6,6 @@ use common::{
comp::item::{Hands, ToolKind},
states::utils::StageSection,
};
use std::f32::consts::PI;
pub struct RepeaterAnimation;
impl Animation for RepeaterAnimation {
@ -36,272 +35,153 @@ impl Animation for RepeaterAnimation {
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.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.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();
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.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)
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.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);
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.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;
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 => {
},
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()),

View File

@ -852,19 +852,16 @@ impl FigureMgr {
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,
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,
};
anim::character::ChargeswingAnimation::update_skeleton(
@ -911,23 +908,19 @@ impl FigureMgr {
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,
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,
};
anim::character::RepeaterAnimation::update_skeleton(