mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Improves bird_large anims
This commit is contained in:
parent
bd84677906
commit
ab26efa970
@ -2,7 +2,7 @@
|
||||
(Phoenix, Male): (
|
||||
wing_in_l: (
|
||||
offset: (-6.0, -5.0, -2.0),
|
||||
lateral: ("npc.phoenix.male.wing_in_l"),
|
||||
lateral: ("npc.phoenix.male.wing_in_r"),
|
||||
),
|
||||
wing_in_r: (
|
||||
offset: (0.0, -5.0, -2.0),
|
||||
@ -10,7 +10,7 @@
|
||||
),
|
||||
wing_mid_l: (
|
||||
offset: (-2.5, -7.0, -2.0),
|
||||
lateral: ("npc.phoenix.male.wing_mid_l"),
|
||||
lateral: ("npc.phoenix.male.wing_mid_r"),
|
||||
),
|
||||
wing_mid_r: (
|
||||
offset: (-2.5, -7.0, -2.0),
|
||||
@ -18,7 +18,7 @@
|
||||
),
|
||||
wing_out_l: (
|
||||
offset: (-9.0, -8.0, -2.0),
|
||||
lateral: ("npc.phoenix.male.wing_out_l"),
|
||||
lateral: ("npc.phoenix.male.wing_out_r"),
|
||||
),
|
||||
wing_out_r: (
|
||||
offset: (0.0, -8.0, -2.0),
|
||||
@ -26,7 +26,7 @@
|
||||
),
|
||||
leg_l: (
|
||||
offset: (-1.5, -1.5, -1.5),
|
||||
lateral: ("npc.phoenix.male.leg_l"),
|
||||
lateral: ("npc.phoenix.male.leg_r"),
|
||||
),
|
||||
leg_r: (
|
||||
offset: (-1.5, -1.5, -1.5),
|
||||
@ -34,7 +34,7 @@
|
||||
),
|
||||
foot_l: (
|
||||
offset: (-1.5, -2.0, -4.0),
|
||||
lateral: ("npc.phoenix.male.foot_l"),
|
||||
lateral: ("npc.phoenix.male.foot_r"),
|
||||
),
|
||||
foot_r: (
|
||||
offset: (-1.5, -2.0, -4.0),
|
||||
@ -44,7 +44,7 @@
|
||||
(Phoenix, Female): (
|
||||
wing_in_l: (
|
||||
offset: (-6.0, -5.0, -2.0),
|
||||
lateral: ("npc.phoenix.male.wing_in_l"),
|
||||
lateral: ("npc.phoenix.male.wing_in_r"),
|
||||
),
|
||||
wing_in_r: (
|
||||
offset: (0.0, -5.0, -2.0),
|
||||
@ -52,7 +52,7 @@
|
||||
),
|
||||
wing_mid_l: (
|
||||
offset: (-2.5, -7.0, -2.0),
|
||||
lateral: ("npc.phoenix.male.wing_mid_l"),
|
||||
lateral: ("npc.phoenix.male.wing_mid_r"),
|
||||
),
|
||||
wing_mid_r: (
|
||||
offset: (-2.5, -7.0, -2.0),
|
||||
@ -60,7 +60,7 @@
|
||||
),
|
||||
wing_out_l: (
|
||||
offset: (-9.0, -8.0, -2.0),
|
||||
lateral: ("npc.phoenix.male.wing_out_l"),
|
||||
lateral: ("npc.phoenix.male.wing_out_r"),
|
||||
),
|
||||
wing_out_r: (
|
||||
offset: (0.0, -8.0, -2.0),
|
||||
@ -68,7 +68,7 @@
|
||||
),
|
||||
leg_l: (
|
||||
offset: (-1.5, -1.5, -1.5),
|
||||
lateral: ("npc.phoenix.male.leg_l"),
|
||||
lateral: ("npc.phoenix.male.leg_r"),
|
||||
),
|
||||
leg_r: (
|
||||
offset: (-1.5, -1.5, -1.5),
|
||||
@ -76,7 +76,7 @@
|
||||
),
|
||||
foot_l: (
|
||||
offset: (-1.5, -2.0, -4.0),
|
||||
lateral: ("npc.phoenix.male.foot_l"),
|
||||
lateral: ("npc.phoenix.male.foot_r"),
|
||||
),
|
||||
foot_r: (
|
||||
offset: (-1.5, -2.0, -4.0),
|
||||
@ -86,7 +86,7 @@
|
||||
(Cockatrice, Male): (
|
||||
wing_in_l: (
|
||||
offset: (-7.0, -8.0, -2.0),
|
||||
lateral: ("npc.cockatrice.male.wing_in_l"),
|
||||
lateral: ("npc.cockatrice.male.wing_in_r"),
|
||||
),
|
||||
wing_in_r: (
|
||||
offset: (0.0, -8.0, -2.0),
|
||||
@ -94,7 +94,7 @@
|
||||
),
|
||||
wing_mid_l: (
|
||||
offset: (-5.0, -9.0, -2.0),
|
||||
lateral: ("npc.cockatrice.male.wing_mid_l"),
|
||||
lateral: ("npc.cockatrice.male.wing_mid_r"),
|
||||
),
|
||||
wing_mid_r: (
|
||||
offset: (0.0, -9.0, -2.0),
|
||||
@ -102,7 +102,7 @@
|
||||
),
|
||||
wing_out_l: (
|
||||
offset: (-10.0, -11.0, -2.0),
|
||||
lateral: ("npc.cockatrice.male.wing_out_l"),
|
||||
lateral: ("npc.cockatrice.male.wing_out_r"),
|
||||
),
|
||||
wing_out_r: (
|
||||
offset: (0.0, -11.0, -2.0),
|
||||
@ -110,7 +110,7 @@
|
||||
),
|
||||
leg_l: (
|
||||
offset: (-3.0, -4.5, -4.0),
|
||||
lateral: ("npc.cockatrice.male.leg_l"),
|
||||
lateral: ("npc.cockatrice.male.leg_r"),
|
||||
),
|
||||
leg_r: (
|
||||
offset: (-3.0, -4.5, -4.0),
|
||||
@ -118,7 +118,7 @@
|
||||
),
|
||||
foot_l: (
|
||||
offset: (-3.5, -5.5, -10.0),
|
||||
lateral: ("npc.cockatrice.male.foot_l"),
|
||||
lateral: ("npc.cockatrice.male.foot_r"),
|
||||
),
|
||||
foot_r: (
|
||||
offset: (-3.5, -5.5, -10.0),
|
||||
@ -128,7 +128,7 @@
|
||||
(Cockatrice, Female): (
|
||||
wing_in_l: (
|
||||
offset: (-7.0, -8.0, -2.0),
|
||||
lateral: ("npc.cockatrice.male.wing_in_l"),
|
||||
lateral: ("npc.cockatrice.male.wing_in_r"),
|
||||
),
|
||||
wing_in_r: (
|
||||
offset: (0.0, -8.0, -2.0),
|
||||
@ -136,7 +136,7 @@
|
||||
),
|
||||
wing_mid_l: (
|
||||
offset: (-5.0, -9.0, -2.0),
|
||||
lateral: ("npc.cockatrice.male.wing_mid_l"),
|
||||
lateral: ("npc.cockatrice.male.wing_mid_r"),
|
||||
),
|
||||
wing_mid_r: (
|
||||
offset: (0.0, -9.0, -2.0),
|
||||
@ -144,7 +144,7 @@
|
||||
),
|
||||
wing_out_l: (
|
||||
offset: (-10.0, -11.0, -2.0),
|
||||
lateral: ("npc.cockatrice.male.wing_out_l"),
|
||||
lateral: ("npc.cockatrice.male.wing_out_r"),
|
||||
),
|
||||
wing_out_r: (
|
||||
offset: (0.0, -11.0, -2.0),
|
||||
@ -152,7 +152,7 @@
|
||||
),
|
||||
leg_l: (
|
||||
offset: (-3.0, -4.5, -4.0),
|
||||
lateral: ("npc.cockatrice.male.leg_l"),
|
||||
lateral: ("npc.cockatrice.male.leg_r"),
|
||||
),
|
||||
leg_r: (
|
||||
offset: (-3.0, -4.5, -4.0),
|
||||
@ -160,7 +160,7 @@
|
||||
),
|
||||
foot_l: (
|
||||
offset: (-3.5, -5.5, -10.0),
|
||||
lateral: ("npc.cockatrice.male.foot_l"),
|
||||
lateral: ("npc.cockatrice.male.foot_r"),
|
||||
),
|
||||
foot_r: (
|
||||
offset: (-3.5, -5.5, -10.0),
|
||||
|
@ -77,7 +77,7 @@ impl Body {
|
||||
Body::BirdMedium(_) => 80.0,
|
||||
Body::FishMedium(_) => 80.0,
|
||||
Body::Dragon(_) => 250.0,
|
||||
Body::BirdLarge(_) => 75.0,
|
||||
Body::BirdLarge(_) => 110.0,
|
||||
Body::FishSmall(_) => 60.0,
|
||||
Body::BipedSmall(biped_small) => match biped_small.species {
|
||||
biped_small::Species::Haniwa => 65.0,
|
||||
|
@ -54,11 +54,11 @@ impl Animation for FeedAnimation {
|
||||
next.chest.orientation = Quaternion::rotation_x(-0.5);
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
next.neck.orientation = Quaternion::rotation_x(-0.8);
|
||||
next.neck.orientation = Quaternion::rotation_x(-0.2);
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(duck_head_look.x)
|
||||
* Quaternion::rotation_x(0.2 - duck_head_look.y.abs() + wave_slow_cos * 0.01);
|
||||
* Quaternion::rotation_x(-0.2 - duck_head_look.y.abs() + wave_slow_cos * 0.01);
|
||||
|
||||
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
|
||||
next.beak.orientation = Quaternion::rotation_x(beak * -0.1 - 0.1);
|
||||
@ -89,9 +89,9 @@ impl Animation for FeedAnimation {
|
||||
next.wing_out_r.orientation = Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_l.orientation = Quaternion::rotation_x(0.5);
|
||||
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) / 8.0;
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.5);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(0.0);
|
||||
|
@ -6,7 +6,7 @@ use super::{
|
||||
pub struct FlyAnimation;
|
||||
|
||||
impl Animation for FlyAnimation {
|
||||
type Dependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>, f32);
|
||||
type Dependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>);
|
||||
type Skeleton = BirdLargeSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -15,7 +15,7 @@ impl Animation for FlyAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_fly")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(velocity, orientation, last_ori, _global_time, _avg_vel, _acc_vel): Self::Dependency,
|
||||
(velocity, orientation, last_ori): Self::Dependency,
|
||||
anim_time: f32,
|
||||
_rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -25,6 +25,7 @@ impl Animation for FlyAnimation {
|
||||
let slow = (anim_time * 2.0).sin();
|
||||
let fast = (anim_time * 4.0).sin();
|
||||
|
||||
// Harmonic series hack to get a sine/saw mix
|
||||
let freq = 8.0;
|
||||
let off1 = 0.0;
|
||||
let off2 = -1.7;
|
||||
@ -59,7 +60,6 @@ impl Animation for FlyAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.beak.scale = Vec3::one() * 0.98;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
@ -73,12 +73,12 @@ impl Animation for FlyAnimation {
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
next.head.orientation = Quaternion::rotation_x(
|
||||
(-0.6 + 0.2 * velocity.xy().magnitude() / 5.0).min(-0.3) + fast * 0.05,
|
||||
(-0.5 + 0.2 * velocity.xy().magnitude() / 5.0).min(-0.3) + fast * 0.05,
|
||||
);
|
||||
|
||||
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
|
||||
|
||||
if velocity.z > 2.0 || velocity.xy().magnitude() < 1.8 {
|
||||
if velocity.z > 2.0 || velocity.xy().magnitude() < 12.0 {
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 - flap4 * 1.5) * s_a.scaler / 8.0;
|
||||
next.chest.orientation = Quaternion::rotation_x(
|
||||
@ -105,24 +105,24 @@ impl Animation for FlyAnimation {
|
||||
|
||||
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(-flap2 * 0.2) * Quaternion::rotation_z(-tilt * 1.0);
|
||||
Quaternion::rotation_x(-flap2 * 0.2 + 0.1) * Quaternion::rotation_z(-tilt * 1.0);
|
||||
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(-flap3 * 0.3) * Quaternion::rotation_z(-tilt * 1.0);
|
||||
Quaternion::rotation_x(-flap3 * 0.3 + 0.15) * Quaternion::rotation_z(-tilt * 0.8);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 - flap4 * 1.5) / 8.0;
|
||||
next.leg_l.orientation = Quaternion::rotation_x(
|
||||
(-1.0 * velocity.xy().magnitude() / 5.0).max(-1.0) + flap1 * -0.1,
|
||||
(-1.0 * velocity.xy().magnitude() / 5.0).max(-1.2) + flap1 * -0.1,
|
||||
) * Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 - flap4 * 1.5) / 8.0;
|
||||
next.leg_r.orientation = Quaternion::rotation_x(
|
||||
(-1.0 * velocity.xy().magnitude() / 5.0).max(-1.0) + flap1 * -0.1,
|
||||
(-1.0 * velocity.xy().magnitude() / 5.0).max(-1.2) + flap1 * -0.1,
|
||||
) * Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(flap1 * -0.05);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(flap1 * -0.1);
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(flap1 * -0.05);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(flap1 * -0.1);
|
||||
} else {
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.05) * s_a.scaler / 8.0;
|
||||
@ -154,16 +154,16 @@ impl Animation for FlyAnimation {
|
||||
|
||||
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(slow * 0.04) * Quaternion::rotation_z(-tilt * 1.0);
|
||||
Quaternion::rotation_x(0.04 - slow * 0.04) * Quaternion::rotation_z(-tilt * 1.0);
|
||||
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(-0.2 + slow * 0.08) * Quaternion::rotation_z(-tilt * 1.0);
|
||||
Quaternion::rotation_x(slow * 0.08) * Quaternion::rotation_z(-tilt * 0.8);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + slow * 0.05) / 8.0;
|
||||
next.leg_l.orientation = Quaternion::rotation_x(-1.0 + slow * -0.05)
|
||||
next.leg_l.orientation = Quaternion::rotation_x(-1.2 + slow * -0.05)
|
||||
* Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + slow * 0.05) / 8.0;
|
||||
next.leg_r.orientation = Quaternion::rotation_x(-1.0 + slow * -0.05)
|
||||
next.leg_r.orientation = Quaternion::rotation_x(-1.2 + slow * -0.05)
|
||||
* Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
|
@ -7,7 +7,7 @@ use std::f32::consts::PI;
|
||||
pub struct RunAnimation;
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Dependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32, Vec3<f32>, f32);
|
||||
type Dependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32);
|
||||
type Skeleton = BirdLargeSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -16,8 +16,8 @@ impl Animation for RunAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(velocity, orientation, last_ori, _global_time, _avg_vel, acc_vel): Self::Dependency,
|
||||
_anim_time: f32,
|
||||
(velocity, orientation, last_ori, acc_vel): Self::Dependency,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
@ -28,25 +28,29 @@ impl Animation for RunAnimation {
|
||||
//let speednorm = speed / 13.0;
|
||||
let speednorm = (speed / 13.0).powf(0.25);
|
||||
|
||||
let speedmult = 2.0;
|
||||
let speedmult = 0.8;
|
||||
let lab: f32 = 0.6; //6
|
||||
|
||||
// acc_vel and anim_time mix to make sure phase lenght isn't starting at
|
||||
// +infinite
|
||||
let mixed_vel = acc_vel + anim_time * 5.0; //sets run frequency using speed, with anim_time setting a floor
|
||||
|
||||
let short = ((1.0
|
||||
/ (0.72
|
||||
+ 0.28 * ((acc_vel * 1.0 * lab * speedmult + PI * -0.15 - 0.5).sin()).powi(2)))
|
||||
+ 0.28 * ((mixed_vel * 1.0 * lab * speedmult + PI * -0.15 - 0.5).sin()).powi(2)))
|
||||
.sqrt())
|
||||
* ((acc_vel * 1.0 * lab * speedmult + PI * -0.15 - 0.5).sin())
|
||||
* ((mixed_vel * 1.0 * lab * speedmult + PI * -0.15 - 0.5).sin())
|
||||
* speednorm;
|
||||
|
||||
//
|
||||
let shortalt = (acc_vel * 1.0 * lab * speedmult + PI * 3.0 / 8.0 - 0.5).sin() * speednorm;
|
||||
let shortalt = (mixed_vel * 1.0 * lab * speedmult + PI * 3.0 / 8.0 - 0.5).sin() * speednorm;
|
||||
|
||||
//FL
|
||||
let foot1a = (acc_vel * 1.0 * lab * speedmult + 0.0 + PI).sin() * speednorm; //1.5
|
||||
let foot1b = (acc_vel * 1.0 * lab * speedmult + 1.57 + PI).sin() * speednorm; //1.9
|
||||
let foot1a = (mixed_vel * 1.0 * lab * speedmult + 0.0 + PI).sin() * speednorm; //1.5
|
||||
let foot1b = (mixed_vel * 1.0 * lab * speedmult + 1.57 + PI).sin() * speednorm; //1.9
|
||||
//FR
|
||||
let foot2a = (acc_vel * 1.0 * lab * speedmult).sin() * speednorm; //1.2
|
||||
let foot2b = (acc_vel * 1.0 * lab * speedmult + 1.57).sin() * speednorm; //1.6
|
||||
let foot2a = (mixed_vel * 1.0 * lab * speedmult).sin() * speednorm; //1.2
|
||||
let foot2b = (mixed_vel * 1.0 * lab * speedmult + 1.57).sin() * speednorm; //1.6
|
||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
||||
@ -63,7 +67,6 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.beak.scale = Vec3::one() * 0.98;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
@ -94,18 +97,16 @@ impl Animation for RunAnimation {
|
||||
* Quaternion::rotation_z(shortalt * 0.10);
|
||||
|
||||
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(short * -0.02);
|
||||
next.tail_front.orientation = Quaternion::rotation_x(0.6 + short * -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(short * -0.1);
|
||||
next.tail_rear.orientation = Quaternion::rotation_x(-0.2 + short * -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(-s_a.wings_angle) * Quaternion::rotation_z(0.2);
|
||||
next.wing_in_r.orientation =
|
||||
Quaternion::rotation_y(s_a.wings_angle) * Quaternion::rotation_z(-0.2);
|
||||
next.wing_in_l.orientation = Quaternion::rotation_y(-0.8) * Quaternion::rotation_z(0.2);
|
||||
next.wing_in_r.orientation = Quaternion::rotation_y(0.8) * 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);
|
||||
|
@ -3,12 +3,11 @@ use super::{
|
||||
BirdLargeSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use std::ops::Mul;
|
||||
|
||||
pub struct StunnedAnimation;
|
||||
|
||||
impl Animation for StunnedAnimation {
|
||||
type Dependency = (f32, f32, Option<StageSection>, f32);
|
||||
type Dependency = (f32, Option<StageSection>, f32);
|
||||
type Skeleton = BirdLargeSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -17,25 +16,13 @@ impl Animation for StunnedAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_stunned")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, global_time, stage_section, timer): Self::Dependency,
|
||||
(global_time, stage_section, timer): Self::Dependency,
|
||||
anim_time: f32,
|
||||
_rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let duck_head_look = Vec2::new(
|
||||
(global_time / 2.0 + anim_time / 8.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.5,
|
||||
(global_time / 2.0 + anim_time / 8.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.25,
|
||||
);
|
||||
let wave_slow_cos = (anim_time * 4.5).cos();
|
||||
|
||||
let (movement1base, movement2, twitch) = match stage_section {
|
||||
@ -64,19 +51,16 @@ impl Animation for StunnedAnimation {
|
||||
next.chest.orientation = Quaternion::rotation_x(movement1base * 0.5);
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
next.neck.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(twitch2 * 0.8)
|
||||
* Quaternion::rotation_x(-duck_head_look.y.abs() + wave_slow_cos * 0.01);
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_z(twitch2 * 0.8) * Quaternion::rotation_x(wave_slow_cos * 0.01);
|
||||
|
||||
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
|
||||
next.beak.orientation = Quaternion::rotation_x(-movement1abs * 0.8);
|
||||
|
||||
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(0.0);
|
||||
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(0.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);
|
||||
@ -99,12 +83,9 @@ impl Animation for StunnedAnimation {
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_l.orientation = Quaternion::rotation_x(movement1abs * 0.8);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(0.0);
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -3283,9 +3283,6 @@ impl FigureMgr {
|
||||
FigureState::new(renderer, BirdLargeSkeleton::default())
|
||||
});
|
||||
|
||||
// Average velocity relative to the current ground
|
||||
let rel_avg_vel = state.avg_vel - physics.ground_vel;
|
||||
|
||||
let (character, last_character) = match (character, last_character) {
|
||||
(Some(c), Some(l)) => (c, l),
|
||||
_ => continue,
|
||||
@ -3316,8 +3313,6 @@ impl FigureMgr {
|
||||
// TODO: Update to use the quaternion.
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
time,
|
||||
rel_avg_vel,
|
||||
state.acc_vel,
|
||||
),
|
||||
state.state_time,
|
||||
@ -3332,9 +3327,6 @@ impl FigureMgr {
|
||||
// TODO: Update to use the quaternion.
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
time,
|
||||
rel_avg_vel,
|
||||
state.acc_vel,
|
||||
),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
@ -3440,12 +3432,7 @@ impl FigureMgr {
|
||||
| PoiseState::KnockedDown => {
|
||||
anim::bird_large::StunnedAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
rel_vel.magnitude(),
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
state.state_time,
|
||||
),
|
||||
(time, Some(s.stage_section), state.state_time),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
|
@ -1058,7 +1058,7 @@ impl<'a> Widget for ItemTooltip<'a> {
|
||||
.w(text_w)
|
||||
.get_h(ui)
|
||||
.unwrap_or(0.0)
|
||||
+ V_PAD
|
||||
+ V_PAD * 2.0
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
@ -367,7 +367,7 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
EntityInfo::at(pos)
|
||||
.with_body(match rng.gen_range(0..11) {
|
||||
.with_body(match rng.gen_range(0..10) {
|
||||
0 => quadruped_small::Body {
|
||||
species: quadruped_small::Species::Fox,
|
||||
body_type: quadruped_small::BodyType::Male,
|
||||
@ -408,14 +408,9 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
&quadruped_medium::Species::Hirdrasil,
|
||||
)
|
||||
.into(),
|
||||
9 => quadruped_small::Body::random_with(
|
||||
rng,
|
||||
&quadruped_small::Species::Truffler,
|
||||
)
|
||||
.into(),
|
||||
_ => quadruped_small::Body::random_with(
|
||||
rng,
|
||||
&quadruped_small::Species::Batfox,
|
||||
&quadruped_small::Species::Truffler,
|
||||
)
|
||||
.into(),
|
||||
})
|
||||
@ -431,6 +426,26 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
* 8.0
|
||||
},
|
||||
},
|
||||
// Temperate solitary wild night
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
EntityInfo::at(pos)
|
||||
.with_body(
|
||||
quadruped_small::Body::random_with(rng, &quadruped_small::Species::Batfox)
|
||||
.into(),
|
||||
)
|
||||
.with_alignment(Alignment::Enemy)
|
||||
},
|
||||
group_size: 1..2,
|
||||
is_underwater: false,
|
||||
day_period: vec![Night],
|
||||
get_density: |c, _col| {
|
||||
close(c.temp, CONFIG.temperate_temp + 0.1, 0.6)
|
||||
* BASE_DENSITY
|
||||
* close(c.humidity, CONFIG.forest_hum, 0.6)
|
||||
* 0.8
|
||||
},
|
||||
},
|
||||
// Rare temperate solitary enemies
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
@ -583,10 +598,29 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
close(c.temp, CONFIG.tropical_temp + 0.2, 0.2)
|
||||
* close(c.humidity, CONFIG.jungle_hum, 0.2)
|
||||
* BASE_DENSITY
|
||||
* 3.0
|
||||
* 2.8
|
||||
},
|
||||
},
|
||||
// Jungle rare solitary wild
|
||||
// Jungle solitary ennemies day
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
EntityInfo::at(pos)
|
||||
.with_body(
|
||||
theropod::Body::random_with(rng, &theropod::Species::Sunlizard).into(),
|
||||
)
|
||||
.with_alignment(Alignment::Enemy)
|
||||
},
|
||||
group_size: 1..2,
|
||||
is_underwater: false,
|
||||
day_period: vec![Morning, Noon, Evening],
|
||||
get_density: |c, _col| {
|
||||
close(c.temp, CONFIG.tropical_temp + 0.2, 0.2)
|
||||
* close(c.humidity, CONFIG.jungle_hum, 0.2)
|
||||
* BASE_DENSITY
|
||||
* 0.5
|
||||
},
|
||||
},
|
||||
// Jungle rare solitary wild day
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
EntityInfo::at(pos)
|
||||
@ -607,7 +641,7 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
},
|
||||
group_size: 1..2,
|
||||
is_underwater: false,
|
||||
day_period: vec![Night, Morning, Noon, Evening],
|
||||
day_period: vec![Morning, Noon, Evening],
|
||||
get_density: |c, _col| {
|
||||
close(c.temp, CONFIG.tropical_temp + 0.2, 0.2)
|
||||
* close(c.humidity, CONFIG.jungle_hum, 0.2)
|
||||
@ -619,16 +653,12 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
EntityInfo::at(pos)
|
||||
.with_body(match rng.gen_range(0..5) {
|
||||
.with_body(match rng.gen_range(0..4) {
|
||||
0 => bird_medium::Body::random_with(rng, &bird_medium::Species::Parrot)
|
||||
.into(),
|
||||
1 => {
|
||||
quadruped_low::Body::random_with(rng, &quadruped_low::Species::Monitor)
|
||||
.into()
|
||||
},
|
||||
2 => bird_large::Body::random_with(rng, &bird_large::Species::Cockatrice)
|
||||
1 => bird_large::Body::random_with(rng, &bird_large::Species::Cockatrice)
|
||||
.into(),
|
||||
3 => quadruped_small::Body::random_with(
|
||||
2 => quadruped_small::Body::random_with(
|
||||
rng,
|
||||
&quadruped_small::Species::Quokka,
|
||||
)
|
||||
@ -650,6 +680,26 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
* 8.0
|
||||
},
|
||||
},
|
||||
// Jungle solitary wild day
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
EntityInfo::at(pos)
|
||||
.with_body(
|
||||
quadruped_low::Body::random_with(rng, &quadruped_low::Species::Monitor)
|
||||
.into(),
|
||||
)
|
||||
.with_alignment(Alignment::Enemy)
|
||||
},
|
||||
group_size: 1..2,
|
||||
is_underwater: false,
|
||||
day_period: vec![Morning, Noon, Evening],
|
||||
get_density: |c, _col| {
|
||||
close(c.temp, CONFIG.tropical_temp + 0.2, 0.3)
|
||||
* close(c.humidity, CONFIG.jungle_hum, 0.2)
|
||||
* BASE_DENSITY
|
||||
* 2.0
|
||||
},
|
||||
},
|
||||
// Tropical rare river enemy
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
@ -867,7 +917,7 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
EntityInfo::at(pos)
|
||||
.with_body(match rng.gen_range(0..7) {
|
||||
.with_body(match rng.gen_range(0..4) {
|
||||
0 => quadruped_small::Body::random_with(
|
||||
rng,
|
||||
&quadruped_small::Species::Holladon,
|
||||
@ -882,21 +932,36 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
&quadruped_medium::Species::Camel,
|
||||
)
|
||||
.into(),
|
||||
3 => quadruped_low::Body {
|
||||
species: quadruped_low::Species::Salamander,
|
||||
body_type: quadruped_low::BodyType::Male,
|
||||
}
|
||||
.into(),
|
||||
4 => quadruped_small::Body::random_with(
|
||||
3 => quadruped_small::Body::random_with(
|
||||
rng,
|
||||
&quadruped_small::Species::Porcupine,
|
||||
)
|
||||
.into(),
|
||||
5 => quadruped_small::Body {
|
||||
_ => quadruped_small::Body {
|
||||
species: quadruped_small::Species::Hare,
|
||||
body_type: quadruped_small::BodyType::Male,
|
||||
}
|
||||
.into(),
|
||||
})
|
||||
.with_alignment(Alignment::Wild)
|
||||
},
|
||||
group_size: 1..2,
|
||||
is_underwater: false,
|
||||
day_period: vec![Night, Morning, Noon, Evening],
|
||||
get_density: |c, _col| {
|
||||
close(c.temp, CONFIG.desert_temp + 0.2, 0.3) * BASE_DENSITY * 3.8
|
||||
},
|
||||
},
|
||||
// Desert solitary wild day
|
||||
Entry {
|
||||
make_entity: |pos, rng| {
|
||||
EntityInfo::at(pos)
|
||||
.with_body(match rng.gen_range(0..3) {
|
||||
1 => quadruped_low::Body {
|
||||
species: quadruped_low::Species::Salamander,
|
||||
body_type: quadruped_low::BodyType::Male,
|
||||
}
|
||||
.into(),
|
||||
_ => quadruped_small::Body::random_with(
|
||||
rng,
|
||||
&quadruped_small::Species::Gecko,
|
||||
@ -907,9 +972,9 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
||||
},
|
||||
group_size: 1..2,
|
||||
is_underwater: false,
|
||||
day_period: vec![Night, Morning, Noon, Evening],
|
||||
day_period: vec![Morning, Noon, Evening],
|
||||
get_density: |c, _col| {
|
||||
close(c.temp, CONFIG.desert_temp + 0.2, 0.3) * BASE_DENSITY * 5.0
|
||||
close(c.temp, CONFIG.desert_temp + 0.2, 0.3) * BASE_DENSITY * 1.0
|
||||
},
|
||||
},
|
||||
// Underwater temperate
|
||||
|
Loading…
Reference in New Issue
Block a user