bandaid fix for swim wield

This commit is contained in:
jshipsey 2020-08-07 01:45:01 -04:00
parent 9ff5c23cf0
commit 316546af22
4 changed files with 457 additions and 18 deletions

View File

@ -21,6 +21,7 @@ pub mod spin;
pub mod spinmelee;
pub mod stand;
pub mod swim;
pub mod swimwield;
pub mod wield;
// Reexports
@ -31,7 +32,7 @@ pub use self::{
glidewield::GlideWieldAnimation, gliding::GlidingAnimation, idle::IdleAnimation,
jump::JumpAnimation, leapmelee::LeapAnimation, roll::RollAnimation, run::RunAnimation,
shoot::ShootAnimation, sit::SitAnimation, sneak::SneakAnimation, spin::SpinAnimation,
spinmelee::SpinMeleeAnimation, stand::StandAnimation, swim::SwimAnimation,
spinmelee::SpinMeleeAnimation, stand::StandAnimation, swim::SwimAnimation, swimwield::SwimWieldAnimation,
wield::WieldAnimation,
};

View File

@ -40,7 +40,7 @@ impl Animation for SwimAnimation {
let lab = 1.0 * tempo;
let short = (anim_time as f32 * lab as f32 * 6.0).sin();
let short = (anim_time as f32 * lab as f32 * 6.0+ PI/2.0).sin();
let foot = (anim_time as f32 * lab as f32 * 6.0).sin();
@ -80,7 +80,7 @@ impl Animation for SwimAnimation {
.reduce_and()
&& ori.angle_between(last_ori).is_finite()
{
ori.angle_between(last_ori).min(0.2)
ori.angle_between(last_ori).min(0.8)
* last_ori.determine_side(Vec2::zero(), ori).signum()
} else {
0.0
@ -92,9 +92,9 @@ impl Animation for SwimAnimation {
-3.0 + skeleton_attr.head.0,
skeleton_attr.head.1 - 1.0 + short * 0.3,
);
next.head.ori = Quaternion::rotation_z(head_look.x + short * -0.6 * intensity)
next.head.ori = Quaternion::rotation_z(head_look.x*0.5 + short * -0.2 * intensity)
* Quaternion::rotation_x(
(0.6 * head_look.y * (1.0 / intensity)).abs()
(0.4 * head_look.y * (1.0 / intensity)).abs()
+ 0.45 * intensity
+ velocity.z * 0.02,
);
@ -105,7 +105,7 @@ impl Animation for SwimAnimation {
skeleton_attr.chest.0,
-13.0 + skeleton_attr.chest.1 + short * 1.3 * intensity,
);
next.chest.ori = Quaternion::rotation_z(short * 0.4 * intensity);
next.chest.ori = Quaternion::rotation_z(short * 0.1 * intensity);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
@ -123,21 +123,21 @@ impl Animation for SwimAnimation {
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-skeleton_attr.hand.0,
1.5 + skeleton_attr.hand.1 - foot * 1.2 * intensity,
2.0 + skeleton_attr.hand.2 + foot * -3.0 * intensity,
-1.0-skeleton_attr.hand.0,
1.5 + skeleton_attr.hand.1 - foot * 2.0 * intensity,
5.0 + skeleton_attr.hand.2 + foot * -5.0 * intensity,
);
next.l_hand.ori =
Quaternion::rotation_x(0.8 + foot * -0.6 * intensity) * Quaternion::rotation_y(0.2);
Quaternion::rotation_x(1.5 + foot * -1.2 * intensity) * Quaternion::rotation_y(0.4+foot*-0.35);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(
skeleton_attr.hand.0,
1.5 + skeleton_attr.hand.1 + foot * 1.2 * intensity,
2.0 + skeleton_attr.hand.2 + foot * 3.0 * intensity,
1.0+skeleton_attr.hand.0,
1.5 + skeleton_attr.hand.1 + foot * 2.0 * intensity,
5.0 + skeleton_attr.hand.2 + foot * 5.0 * intensity,
);
next.r_hand.ori =
Quaternion::rotation_x(0.8 + foot * 0.6 * intensity) * Quaternion::rotation_y(-0.2);
Quaternion::rotation_x(1.5 + foot * 1.2 * intensity) * Quaternion::rotation_y(-0.4+foot*-0.35);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(
@ -221,7 +221,7 @@ impl Animation for SwimAnimation {
next.torso.offset = Vec3::new(0.0, 0.0, 1.0) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(adjust + avg_vel.z * 0.12)
* Quaternion::rotation_z(tilt * 12.0 + short * 0.4 * intensity);
* Quaternion::rotation_z(tilt * 12.0 + short * 0.0 * intensity);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one();

View File

@ -0,0 +1,426 @@
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
use common::comp::item::{Hands, ToolKind};
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct SwimWieldAnimation;
impl Animation for SwimWieldAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f64);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"character_swimwield\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_swimwield")]
#[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): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
*rate = 1.0;
let lab = 1.0;
let speed = Vec3::<f32>::from(velocity).magnitude();
*rate = 1.0;
let intensity = if speed > 0.5 { 1.0 } else { 0.3 };
let footrotl = (((1.0)
/ (0.2
+ (0.8)
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin());
let footrotr = (((1.0)
/ (0.2
+ (0.8)
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin());
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 3.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 3.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
);
let slowalt = (anim_time as f32 * 6.0 + PI).cos();
let u_slow = (anim_time as f32 * 1.0 + PI).sin();
let slow = (anim_time as f32 * 3.0 + PI).sin();
let foothoril = (anim_time as f32 * 6.0 * lab as f32 + PI * 1.45).sin();
let foothorir = (anim_time as f32 * 6.0 * lab as f32 + PI * (0.45)).sin();
let u_slowalt = (anim_time as f32 * 3.0 + PI).cos();
let short = (((5.0)
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 16.0).sin());
let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin();
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
next.l_foot.offset = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * 1.5 * intensity,
-15.0 + skeleton_attr.foot.2 + footrotl * 3.0 * intensity,
);
next.l_foot.ori = Quaternion::rotation_x(-0.8 + footrotl * 0.4 * intensity);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * 1.5 * intensity,
-15.0 + skeleton_attr.foot.2 + footrotr * 3.0 * intensity,
);
next.r_foot.ori = Quaternion::rotation_x(-0.8 + footrotr * 0.4 * intensity);
next.r_foot.scale = Vec3::one();
if velocity > 0.1 {
next.torso.offset = Vec3::new(0.0, 0.0, 1.0) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(velocity * -0.05);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.ori = Quaternion::rotation_x(
(-0.5 + short * 0.3 + noisea * 0.3 + noiseb * 0.3).min(-0.1),
);
next.back.scale = Vec3::one() * 1.02;
} else {
next.head.offset = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1,
);
next.head.ori =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(
0.0 + slowalt * 0.5,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + u_slow * 0.5,
);
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.l_foot.offset = Vec3::new(
-skeleton_attr.foot.0,
-2.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.r_foot.offset = Vec3::new(
skeleton_attr.foot.0,
2.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.chest.ori =
Quaternion::rotation_y(u_slowalt * 0.04) * Quaternion::rotation_z(0.15);
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori = Quaternion::rotation_y(u_slowalt * 0.03) * Quaternion::rotation_z(0.22);
next.belt.scale = Vec3::one() * 1.02;
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.ori = Quaternion::rotation_x(-0.2);
next.back.scale = Vec3::one() * 1.02;
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_z(0.3);
}
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Sword(_)) => {
next.l_hand.offset = Vec3::new(-0.75, -1.0, -2.5);
next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.offset = Vec3::new(0.75, -1.5, -5.5);
next.r_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 0.0, -3.0);
next.main.ori = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(u_slow * 0.15)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(u_slowalt * 0.08);
next.control.scale = Vec3::one();
},
Some(ToolKind::Dagger(_)) => {
// hands should be larger when holding a dagger grip,
// also reduce flicker with overlapping polygons
let hand_scale = 1.12;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
//next.control.ori = Quaternion::rotation_x(slow * 1.0);
// * Quaternion::rotation_y(0.0)
// * Quaternion::rotation_z(u_slowalt * 0.08);
// next.control.scale = Vec3::one();
next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.l_hand.scale = Vec3::one() * hand_scale;
next.main.offset = Vec3::new(0.0, 0.0, 0.0);
next.main.ori = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.l_control.offset = Vec3::new(-7.0, 0.0, 0.0);
// next.l_control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0)
// * Quaternion::rotation_y(0.0)
// * Quaternion::rotation_z(u_slowalt * 0.08);
// next.l_control.scale = Vec3::one();
next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_hand.ori = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.r_hand.scale = Vec3::one() * hand_scale;
next.second.offset = Vec3::new(0.0, 0.0, 0.0);
next.second.ori = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.second.scale = Vec3::one();
next.r_control.offset = Vec3::new(7.0, 0.0, 0.0);
// next.r_control.ori = Quaternion::rotation_x(0.0 * PI)
// * Quaternion::rotation_y(0.0 * PI)
// * Quaternion::rotation_z(0.0 * PI);
// next.r_control.scale = Vec3::one();
},
Some(ToolKind::Axe(_)) => {
if velocity < 0.5 {
next.head.offset = Vec3::new(
0.0,
-3.5 + skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1,
);
next.head.ori = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.35 + head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.ori = Quaternion::rotation_x(-0.35)
* Quaternion::rotation_y(u_slowalt * 0.04)
* Quaternion::rotation_z(0.15);
next.belt.offset =
Vec3::new(0.0, 1.0 + skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y(u_slowalt * 0.03)
* Quaternion::rotation_z(0.15);
next.shorts.offset =
Vec3::new(0.0, 1.0 + skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
next.control.ori = Quaternion::rotation_x(1.8)
* Quaternion::rotation_y(-0.5)
* Quaternion::rotation_z(PI - 0.2);
next.control.scale = Vec3::one();
} else {
next.control.ori = Quaternion::rotation_x(2.1)
* Quaternion::rotation_y(-0.4)
* Quaternion::rotation_z(PI - 0.2);
next.control.scale = Vec3::one();
}
next.l_hand.offset = Vec3::new(-0.5, 0.0, 4.0);
next.l_hand.ori = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(0.0);
next.l_hand.scale = Vec3::one() * 1.08;
next.r_hand.offset = Vec3::new(0.5, 0.0, -2.5);
next.r_hand.ori = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(0.0);
next.r_hand.scale = Vec3::one() * 1.06;
next.main.offset = Vec3::new(-0.0, -2.0, -1.0);
next.main.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.offset = Vec3::new(-3.0, 11.0, 3.0);
},
Some(ToolKind::Hammer(_)) => {
next.l_hand.offset = Vec3::new(-12.0, 0.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0);
next.l_hand.scale = Vec3::one() * 1.08;
next.r_hand.offset = Vec3::new(2.0, 0.0, 0.0);
next.r_hand.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
next.r_hand.scale = Vec3::one() * 1.06;
next.main.offset = Vec3::new(0.0, 0.0, 0.0);
next.main.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_z(1.57);
next.control.offset = Vec3::new(6.0, 7.0, 1.0);
next.control.ori = Quaternion::rotation_x(0.3 + u_slow * 0.15)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(u_slowalt * 0.08);
next.control.scale = Vec3::one();
},
Some(ToolKind::Staff(_)) => {
next.l_hand.offset = Vec3::new(1.5, 0.5, -4.0);
next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.3);
next.l_hand.scale = Vec3::one() * 1.05;
next.r_hand.offset = Vec3::new(8.0, 4.0, 2.0);
next.r_hand.ori = Quaternion::rotation_x(1.8)
* Quaternion::rotation_y(0.5)
* Quaternion::rotation_z(-0.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(12.0, 8.4, 13.2);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);
next.control.offset = Vec3::new(-14.0, 1.8, 3.0);
next.control.ori = Quaternion::rotation_x(u_slow * 0.2)
* Quaternion::rotation_y(-0.2)
* Quaternion::rotation_z(u_slowalt * 0.1);
next.control.scale = Vec3::one();
},
Some(ToolKind::Shield(_)) => {
// hands should be larger when holding a dagger grip,
// also reduce flicker with overlapping polygons
let hand_scale = 1.12;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
// next.control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0)
// * Quaternion::rotation_y(0.0)
// * Quaternion::rotation_z(u_slowalt * 0.08);
// next.control.scale = Vec3::one();
next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.l_hand.scale = Vec3::one() * hand_scale;
next.main.offset = Vec3::new(0.0, 0.0, 0.0);
next.main.ori = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.l_control.offset = Vec3::new(-7.0, 0.0, 0.0);
// next.l_control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0)
// * Quaternion::rotation_y(0.0)
// * Quaternion::rotation_z(u_slowalt * 0.08);
// next.l_control.scale = Vec3::one();
next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_hand.ori = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.r_hand.scale = Vec3::one() * hand_scale;
next.second.offset = Vec3::new(0.0, 0.0, 0.0);
next.second.ori = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.second.scale = Vec3::one();
next.r_control.offset = Vec3::new(7.0, 0.0, 0.0);
// next.r_control.ori = Quaternion::rotation_x(0.0 * PI)
// * Quaternion::rotation_y(0.0 * PI)
// * Quaternion::rotation_z(0.0 * PI);
// next.r_control.scale = Vec3::one();
},
Some(ToolKind::Bow(_)) => {
next.l_hand.offset = Vec3::new(2.0, 1.5, 0.0);
next.l_hand.ori = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.l_hand.scale = Vec3::one() * 1.05;
next.r_hand.offset = Vec3::new(5.9, 4.5, -5.0);
next.r_hand.ori = 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.offset = Vec3::new(3.0, 2.0, -13.0);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.hold.offset = Vec3::new(1.2, -1.0, -5.2);
next.hold.ori = Quaternion::rotation_x(-1.7)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-0.1);
next.hold.scale = Vec3::one() * 1.0;
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori =
Quaternion::rotation_x(u_slow * 0.2) * Quaternion::rotation_z(u_slowalt * 0.1);
next.control.scale = Vec3::one();
},
Some(ToolKind::Debug(_)) => {
next.l_hand.offset = Vec3::new(-7.0, 4.0, 3.0);
next.l_hand.ori = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(7.0, 2.5, -1.25);
next.r_hand.ori = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(5.0, 8.75, -2.0);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.27)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(0.0, 6.0, 6.0);
next.control.ori =
Quaternion::rotation_x(u_slow * 0.2) * Quaternion::rotation_z(u_slowalt * 0.1);
next.control.scale = Vec3::one();
},
Some(ToolKind::Farming(_)) => {
if velocity < 0.5 {
next.head.ori = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(-0.2 + head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
}
next.l_hand.offset = Vec3::new(9.0, 1.0, 1.0);
next.l_hand.ori = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.0);
next.l_hand.scale = Vec3::one() * 1.05;
next.r_hand.offset = Vec3::new(9.0, 1.0, 11.0);
next.r_hand.ori = Quaternion::rotation_x(1.57)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(7.5, 7.5, 13.2);
next.main.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(3.14)
* Quaternion::rotation_z(0.0);
next.control.offset = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
next.control.ori = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
next.control.scale = Vec3::one();
},
_ => {},
}
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
}
}

View File

@ -597,7 +597,7 @@ impl FigureMgr {
skeleton_attr,
),
// Running
(true, true, _) => anim::character::RunAnimation::update_skeleton(
(true, true, false) => anim::character::RunAnimation::update_skeleton(
&CharacterSkeleton::new(),
(
active_tool_kind.clone(),
@ -627,7 +627,7 @@ impl FigureMgr {
skeleton_attr,
),
// Swim
(false, _, true) => anim::character::SwimAnimation::update_skeleton(
(_, _, true) => anim::character::SwimAnimation::update_skeleton(
&CharacterSkeleton::new(),
(
active_tool_kind.clone(),
@ -823,13 +823,25 @@ impl FigureMgr {
)
},
CharacterState::Wielding { .. } => {
if physics.in_fluid {
anim::character::SwimWieldAnimation::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::WieldAnimation::update_skeleton(
&target_base,
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
)
}
},
CharacterState::Glide { .. } => {
anim::character::GlidingAnimation::update_skeleton(