animation tweaks

This commit is contained in:
jshipsey 2021-09-05 03:43:22 -04:00 committed by Robin Gilh
parent 299ca581ea
commit 1ad107f4a7
13 changed files with 114 additions and 201 deletions

View File

@ -71,7 +71,7 @@ pub const ALL_SPECIES: [Species; 4] = [
Species::Cockatrice,
Species::Roc,
Species::FlameWyvern,
];
];
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;

View File

@ -352,6 +352,9 @@ fn default_main_tool(body: &Body) -> Item {
(bird_large::Species::Roc, _) => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.birdlargebasic",
)),
(bird_large::Species::FlameWyvern, _) => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.birdlargebreathe",
)),
},
_ => None,
};
@ -447,28 +450,6 @@ impl LoadoutBuilder {
quadruped_low::Species::Tortoise => {
Some("common.items.npc_armor.quadruped_low.shell")
},
Body::BirdLarge(bird_large) => match (bird_large.species, bird_large.body_type) {
(bird_large::Species::Cockatrice, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.birdlargebreathe",
));
},
(bird_large::Species::Phoenix, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.birdlargefire",
));
},
(bird_large::Species::Roc, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.birdlargebasic",
));
},
(bird_large::Species::FlameWyvern, _) => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.birdlargebreathe",
));
},
},
_ => None,
},
Body::Theropod(body) => match body.species {

View File

@ -7,7 +7,7 @@ use common::states::utils::StageSection;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency<'a> = (Option<StageSection>, Vec3<f32>, Vec3<f32>, bool);
type Dependency<'a> = (Option<StageSection>, f32, f32, Vec3<f32>, Vec3<f32>, bool);
type Skeleton = BirdLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,7 +16,7 @@ impl Animation for AlphaAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_alpha")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(stage_section, orientation, last_ori, on_ground): Self::Dependency<'a>,
(stage_section, global_time, timer, orientation, last_ori, on_ground): Self::Dependency<'a>,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
@ -34,9 +34,13 @@ impl Animation for AlphaAnimation {
let pullback = 1.0 - move3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum();
let move1 = move1base * pullback;
let move2 = move2base * pullback;
let move1mirror = move1base * pullback * mirror;
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
let tilt = if ::vek::Vec2::new(ori, last_ori)
@ -51,28 +55,25 @@ impl Animation for AlphaAnimation {
0.0
} * 1.3;
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06);
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
s_a.chest.1 + wave_slow_cos * 0.06 + move2 * -6.0,
);
next.chest.orientation = Quaternion::rotation_x(move1 * 0.5 - move2 * 0.8);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_x(move1 * 0.5 - move2 * 0.8)
* Quaternion::rotation_z(move1 * tilt * 1.5);
next.neck.orientation = Quaternion::rotation_x(move1 * 0.5 - move2 * 0.4)
* Quaternion::rotation_z(move1 * tilt * 1.5)
* Quaternion::rotation_y(move1mirror * 0.3);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(move1 * 0.5 - move2 * 0.8);
next.head.orientation = Quaternion::rotation_x(move1 * -0.2 - move2 * 0.2)
* Quaternion::rotation_y(move1mirror * 0.5);
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
next.beak.orientation = Quaternion::rotation_x(wave_slow_cos * -0.02 - 0.02);
next.beak.orientation =
Quaternion::rotation_x(wave_slow_cos * -0.02 + move1 * -0.5 + move2 * 0.5);
if on_ground {
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
@ -84,23 +85,25 @@ impl Animation for AlphaAnimation {
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation =
Quaternion::rotation_y(-1.0 + wave_slow_cos * 0.06) * Quaternion::rotation_z(0.2);
Quaternion::rotation_y(-1.0 + wave_slow_cos * 0.06 + move1 * 1.0 + move2 * 0.5)
* Quaternion::rotation_z(0.2);
next.wing_in_r.orientation =
Quaternion::rotation_y(1.0 - wave_slow_cos * 0.06) * Quaternion::rotation_z(-0.2);
Quaternion::rotation_y(1.0 - wave_slow_cos * 0.06 + move1 * -1.0 + move2 * -0.5)
* Quaternion::rotation_z(-0.2);
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_r.position = Vec3::new(s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_l.orientation =
Quaternion::rotation_y(-0.1) * Quaternion::rotation_z(0.7);
next.wing_mid_r.orientation =
Quaternion::rotation_y(0.1) * Quaternion::rotation_z(-0.7);
next.wing_mid_l.orientation = Quaternion::rotation_y(-0.1 + move1 * -0.5)
* Quaternion::rotation_z(0.7 + move1 * -0.7);
next.wing_mid_r.orientation = Quaternion::rotation_y(0.1 + move1 * 0.5)
* Quaternion::rotation_z(-0.7 + move1 * 0.7);
next.wing_out_l.position = Vec3::new(-s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_l.orientation =
Quaternion::rotation_y(-0.2) * Quaternion::rotation_z(0.2);
Quaternion::rotation_y(-0.2 + move1 * -0.3) * Quaternion::rotation_z(0.2);
next.wing_out_r.orientation =
Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
Quaternion::rotation_y(0.2 + move1 * 0.3) * Quaternion::rotation_z(-0.2);
} else {
}

View File

@ -7,6 +7,7 @@ use common::{states::utils::StageSection, util::Dir};
pub struct BreatheAnimation;
type BreatheAnimationDependency = (
Vec3<f32>,
f32,
Vec3<f32>,
Vec3<f32>,
@ -26,7 +27,7 @@ impl Animation for BreatheAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_breathe")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(global_time, orientation, last_ori, stage_section, timer, look_dir, on_ground): Self::Dependency<'a>,
(velocity,global_time, _orientation, _last_ori, stage_section, timer, look_dir, on_ground): Self::Dependency<'a>,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
@ -51,16 +52,6 @@ impl Animation for BreatheAnimation {
let wave_slow_cos = (anim_time * 4.5).cos();
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
@ -68,7 +59,8 @@ impl Animation for BreatheAnimation {
);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_x(movement1abs * 0.5 - movement2abs * 0.5);
next.neck.orientation =
Quaternion::rotation_x(movement1abs * 0.8 - movement2abs * 0.5 + twitch2 * -0.02);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation =
@ -79,17 +71,19 @@ impl Animation for BreatheAnimation {
if on_ground {
next.chest.orientation =
Quaternion::rotation_x(movement1abs * 0.1 - movement2abs * 0.1);
Quaternion::rotation_x(movement1abs * 0.2 - movement2abs * 0.5 + twitch2 * 0.03);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement2abs * -3.0);
next.wing_in_l.position = Vec3::new(-s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation =
Quaternion::rotation_y(-1.0 + movement1abs * 0.8 - movement2abs * 0.4)
* Quaternion::rotation_z(0.2 - movement1abs * 0.8 + movement2abs * 0.4);
Quaternion::rotation_y(
-1.0 + movement1abs * 0.8 - movement2abs * 0.4 + twitch2 * 0.03,
) * Quaternion::rotation_z(0.2 - movement1abs * 0.8 + movement2abs * 0.4);
next.wing_in_r.orientation =
Quaternion::rotation_y(1.0 - movement1abs * 0.8 + movement2abs * 0.4)
* Quaternion::rotation_z(-0.2 + movement1abs * 0.8 - movement2abs * 0.4);
Quaternion::rotation_y(
1.0 - movement1abs * 0.8 + movement2abs * 0.4 + twitch2 * -0.03,
) * Quaternion::rotation_z(-0.2 + movement1abs * 0.8 - movement2abs * 0.4);
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_r.position = Vec3::new(s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
@ -107,28 +101,19 @@ impl Animation for BreatheAnimation {
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation =
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * 0.02);
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * 0.1);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation =
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * 0.02);
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * -0.2);
} else {
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
let tilt = if ::vek::Vec2::new(ori, last_ori)
.map(|o| o.magnitude_squared())
.map(|m| m > 0.001 && m.is_finite())
.reduce_and()
&& ori.angle_between(last_ori).is_finite()
{
ori.angle_between(last_ori).min(0.2)
* last_ori.determine_side(Vec2::zero(), ori).signum()
} else {
0.0
} * 1.3;
if velocity.xy().magnitude() < 1.0 {
next.neck.orientation =
Quaternion::rotation_x(movement1abs * -0.4 - movement2abs * 0.5);
next.chest.orientation =
Quaternion::rotation_x(movement1abs * 0.1 - movement2abs * 0.1)
* Quaternion::rotation_y(tilt * 1.8);
next.head.orientation = Quaternion::rotation_x(
movement1abs * 0.5 - movement2abs * 0.5 + look_dir.z * 0.4,
);
};
}
next

View File

@ -39,16 +39,6 @@ impl Animation for FeedAnimation {
let wave_fast = (anim_time * 9.0).cos();
let beak = (anim_time * 16.0).sin();
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 - 1.8);
next.chest.orientation = Quaternion::rotation_x(s_a.feed);

View File

@ -26,7 +26,7 @@ impl Animation for FlyAnimation {
let fast = (anim_time * 4.0).sin();
// Harmonic series hack to get a sine/saw mix
let freq = if s_a.wyvern {6.0} else {8.0};
let freq = if s_a.wyvern { 6.0 } else { 8.0 };
let off1 = 0.0;
let off2 = -1.7;
let off3 = -2.0;
@ -60,11 +60,11 @@ impl Animation for FlyAnimation {
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.leg_l.scale = Vec3::one();
next.leg_r.scale = Vec3::one();
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;

View File

@ -39,11 +39,11 @@ impl Animation for IdleAnimation {
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.leg_l.scale = Vec3::one();
next.leg_r.scale = Vec3::one();
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler / 8.0 * 0.99;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
@ -53,7 +53,7 @@ impl Animation for IdleAnimation {
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
next.beak.orientation = Quaternion::rotation_x(wave_slow_cos * -0.02 - 0.02);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
next.leg_l.orientation = Quaternion::rotation_x(0.0);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2);
next.leg_r.orientation = Quaternion::rotation_x(0.0);
@ -65,7 +65,7 @@ impl Animation for IdleAnimation {
if s_a.wyvern {
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06) * s_a.scaler / 8.0;
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06) * s_a.scaler;
next.chest.orientation = Quaternion::rotation_x(-0.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
@ -104,8 +104,7 @@ impl Animation for IdleAnimation {
* Quaternion::rotation_z(-0.55);
} else {
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 + 1.5) * s_a.scaler
/ 8.0;
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 + 1.5) * s_a.scaler;
next.chest.orientation = Quaternion::rotation_x(0.0);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);

View File

@ -67,11 +67,11 @@ impl Animation for RunAnimation {
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.leg_l.scale = Vec3::one();
next.leg_r.scale = Vec3::one();
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler* 0.99;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
@ -93,7 +93,7 @@ impl Animation for RunAnimation {
s_a.foot.1 + foot1b * -1.0,
s_a.foot.2 + (foot1a * 1.5).max(0.0),
);
next.foot_l.orientation = Quaternion::rotation_x(0.2 * speednorm + foot1b * -0.5 + 0.1)
next.foot_l.orientation = Quaternion::rotation_x(0.2 * speednorm + foot1b * -0.8 + 0.1)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(tilt * -0.5);
@ -102,7 +102,7 @@ impl Animation for RunAnimation {
s_a.foot.1 + foot2b * -1.0,
s_a.foot.2 + (foot2a * 1.5).max(0.0),
);
next.foot_r.orientation = Quaternion::rotation_x(0.2 * speednorm + foot2b * -0.5 + 0.1)
next.foot_r.orientation = Quaternion::rotation_x(0.2 * speednorm + foot2b * -0.8 + 0.1)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(tilt * -0.5);
@ -111,8 +111,7 @@ impl Animation for RunAnimation {
0.0,
s_a.chest.0,
s_a.chest.1 + short * 0.5 + speednorm * -2.0,
) * s_a.scaler
/ 8.0;
) * s_a.scaler;
next.chest.orientation = Quaternion::rotation_x(-0.1 + short * 0.07)
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(shortalt * 0.10);
@ -162,16 +161,16 @@ impl Animation for RunAnimation {
next.leg_l.position = Vec3::new(
-s_a.leg.0,
s_a.leg.1 + foot1b * -2.3,
s_a.leg.2,
) / 8.0;
s_a.leg.2 + foot2b * -1.5,
);
next.leg_l.orientation = Quaternion::rotation_x(-1.0 * speednorm + foot1a * 0.15)
* Quaternion::rotation_y(tilt * 0.5);
next.leg_r.position = Vec3::new(
s_a.leg.0,
s_a.leg.1 + foot2b * -2.3,
s_a.leg.2,
) / 8.0;
s_a.leg.2 + foot1b * -1.5,
);
next.leg_r.orientation = Quaternion::rotation_x(-1.0 * speednorm + foot2a * 0.15)
* Quaternion::rotation_y(tilt * 0.5);
} else {
@ -179,8 +178,7 @@ impl Animation for RunAnimation {
0.0,
s_a.chest.0,
s_a.chest.1 + short * 0.5 + 0.5 * speednorm,
) * s_a.scaler
/ 8.0;
) * s_a.scaler;
next.chest.orientation = Quaternion::rotation_x(short * 0.07)
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(shortalt * 0.10);
@ -211,19 +209,11 @@ impl Animation for RunAnimation {
next.wing_out_r.orientation =
Quaternion::rotation_y(0.2 + short * -0.05) * Quaternion::rotation_z(-0.2);
next.leg_l.position = Vec3::new(
-s_a.leg.0,
s_a.leg.1 + foot1b * -2.3,
s_a.leg.2,
) / 8.0;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1 + foot1b * -2.3, s_a.leg.2);
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
* Quaternion::rotation_y(tilt * 0.5);
next.leg_r.position = Vec3::new(
s_a.leg.0,
s_a.leg.1 + foot2b * -2.3,
s_a.leg.2,
) / 8.0;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1 + foot2b * -2.3, s_a.leg.2);
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
* Quaternion::rotation_y(tilt * 0.5);
}

View File

@ -38,16 +38,6 @@ impl Animation for ShockwaveAnimation {
let wave_slow_cos = (anim_time * 4.5).cos();
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1abs * 1.5);
next.chest.orientation = Quaternion::rotation_x(movement1abs * 1.0 + movement2abs * -1.0);

View File

@ -6,7 +6,7 @@ use common::{states::utils::StageSection, util::Dir};
pub struct ShootAnimation;
type ShootAnimationDependency = (f32, Option<StageSection>, f32, Dir, bool);
type ShootAnimationDependency = (Vec3<f32>, f32, Option<StageSection>, f32, Dir, bool);
impl Animation for ShootAnimation {
type Dependency<'a> = ShootAnimationDependency;
@ -18,18 +18,17 @@ impl Animation for ShootAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_shoot")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(global_time, stage_section, timer, look_dir, on_ground): Self::Dependency<'a>,
(velocity, global_time, stage_section, timer, look_dir, on_ground): Self::Dependency<'a>,
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2base, movement3, twitch) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time.min(1.0).powf(0.1), 0.0, anim_time),
Some(StageSection::Recover) => (1.0, 1.0, anim_time, 1.0),
_ => (0.0, 0.0, 0.0, 0.0),
let (movement1base, movement3, twitch) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Recover) => (1.0, anim_time.powf(0.25), anim_time),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
@ -37,22 +36,11 @@ impl Animation for ShootAnimation {
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum();
let twitch2 = mirror * (twitch * 20.0).sin() * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
let movement1mirror = movement1abs * mirror;
let wave_slow_cos = (anim_time * 4.5).cos();
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
@ -61,51 +49,44 @@ impl Animation for ShootAnimation {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation =
Quaternion::rotation_x(movement1abs * 0.5 - movement2abs * 0.5 + look_dir.z * 0.4);
Quaternion::rotation_x(movement1abs * 0.5 + look_dir.z * 0.4 + twitch2)
* Quaternion::rotation_y(movement1mirror * 0.5);
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
next.beak.orientation = Quaternion::rotation_x(movement1abs * -0.7 + twitch2 * 0.1);
if on_ground {
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
s_a.chest.1 + wave_slow_cos * 0.06 + twitch2 * 0.1 + movement1abs * -3.0,
);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_x(movement1abs * 0.5 - movement2abs * 0.5);
next.neck.orientation = Quaternion::rotation_x(movement1abs * 0.5)
* Quaternion::rotation_y(movement1mirror * 0.2);
next.chest.orientation =
Quaternion::rotation_x(movement1abs * 0.1 - movement2abs * 0.1);
next.wing_in_l.position = Vec3::new(-s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation =
Quaternion::rotation_y(-1.0 + movement1abs * 0.8 - movement2abs * 0.4)
* Quaternion::rotation_z(0.2 - movement1abs * 0.8 + movement2abs * 0.4);
next.wing_in_r.orientation =
Quaternion::rotation_y(1.0 - movement1abs * 0.8 + movement2abs * 0.4)
* Quaternion::rotation_z(-0.2 + movement1abs * 0.8 - movement2abs * 0.4);
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_r.position = Vec3::new(s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
next.wing_mid_l.orientation =
Quaternion::rotation_y(-0.1) * Quaternion::rotation_z(0.7);
next.wing_mid_r.orientation =
Quaternion::rotation_y(0.1) * Quaternion::rotation_z(-0.7);
next.wing_out_l.position = Vec3::new(-s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_l.orientation =
Quaternion::rotation_y(-0.2) * Quaternion::rotation_z(0.2);
next.wing_out_r.orientation =
Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
next.chest.orientation = Quaternion::rotation_x(movement1abs * 0.1);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation =
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * 0.02);
Quaternion::rotation_x(-movement1abs * 0.1 + twitch2 * 0.02);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation =
Quaternion::rotation_x(-movement1abs * 0.1 + movement2abs * 0.1 + twitch2 * 0.02);
Quaternion::rotation_x(-movement1abs * 0.1 + twitch2 * 0.02);
next.leg_l.orientation = Quaternion::rotation_x(movement1abs * -0.5);
next.leg_r.orientation = Quaternion::rotation_x(movement1abs * -0.5);
next.foot_l.orientation = Quaternion::rotation_x(movement1abs * 0.3);
next.foot_r.orientation = Quaternion::rotation_x(movement1abs * 0.3);
} else {
}
if velocity.xy().magnitude() < 1.0 {
next.wing_in_l.orientation = Quaternion::rotation_y(-1.0 + movement1abs * 0.8)
* Quaternion::rotation_z(0.2 - movement1abs * 0.8);
next.wing_in_r.orientation = Quaternion::rotation_y(1.0 - movement1abs * 0.8)
* Quaternion::rotation_z(-0.2 + movement1abs * 0.8);
};
next
}
}

View File

@ -37,16 +37,6 @@ impl Animation for StunnedAnimation {
let twitch2 = mirror * (twitch * 20.0).sin() * pullback;
let movement1abs = movement1base * pullback;
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06);
next.chest.orientation = Quaternion::rotation_x(movement1base * 0.5);

View File

@ -43,8 +43,8 @@ impl Animation for SwimAnimation {
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.scale = Vec3::one() / 8.0;
next.leg_l.scale = Vec3::one();
next.leg_r.scale = Vec3::one();
next.foot_l.scale = Vec3::one() * 1.01;
next.foot_r.scale = Vec3::one() * 1.01;
next.chest.scale = Vec3::one() * s_a.scaler * 0.99;

View File

@ -3427,6 +3427,7 @@ impl FigureMgr {
anim::bird_large::BreatheAnimation::update_skeleton(
&target_base,
(
rel_vel,
time,
ori * anim::vek::Vec3::<f32>::unit_y(),
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
@ -3465,6 +3466,8 @@ impl FigureMgr {
&target_base,
(
Some(s.stage_section),
time,
state.state_time,
ori * anim::vek::Vec3::<f32>::unit_y(),
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
physics.on_ground.is_some(),
@ -3490,6 +3493,7 @@ impl FigureMgr {
anim::bird_large::ShootAnimation::update_skeleton(
&target_base,
(
rel_vel,
time,
Some(s.stage_section),
state.state_time,