Merge branch 'snowram/wyvern' into 'master'

Snowram/wyvern

See merge request veloren/veloren!2847
This commit is contained in:
Justin Shipsey 2021-09-21 14:20:33 +00:00
commit 2c3640b527
31 changed files with 578 additions and 259 deletions

View File

@ -1120,6 +1120,10 @@
keyword: "roc",
generic: "Roc"
),
wyvern_flame: (
keyword: "wyvern_flame",
generic: "Flame Wyvern"
),
)
),
quadruped_low: (

View File

@ -155,4 +155,56 @@
central: ("npc.roc.male.tail_rear"),
)
),
(FlameWyvern, Male): (
head: (
offset: (-5.5, -5.0, 0.0),
central: ("npc.wyvern_flame.male.head"),
),
beak: (
offset: (-2.5, 0.0, -5.0),
central: ("npc.wyvern_flame.male.beak"),
),
neck: (
offset: (-2.5, 0.0, -3.5),
central: ("npc.wyvern_flame.male.neck"),
),
chest: (
offset: (-6.5, -12.0, -9.0),
central: ("npc.wyvern_flame.male.chest"),
),
tail_front: (
offset: (-2.5, -12.0, -7.0),
central: ("npc.wyvern_flame.male.tail_front"),
),
tail_rear: (
offset: (-4.5, -29.0, -8.0),
central: ("npc.wyvern_flame.male.tail_rear"),
)
),
(FlameWyvern, Female): (
head: (
offset: (-5.5, -5.0, 0.0),
central: ("npc.wyvern_flame.male.head"),
),
beak: (
offset: (-2.5, 0.0, -5.0),
central: ("npc.wyvern_flame.male.beak"),
),
neck: (
offset: (-2.5, 0.0, -3.5),
central: ("npc.wyvern_flame.male.neck"),
),
chest: (
offset: (-6.5, -12.0, -9.0),
central: ("npc.wyvern_flame.male.chest"),
),
tail_front: (
offset: (-2.5, -12.0, -7.0),
central: ("npc.wyvern_flame.male.tail_front"),
),
tail_rear: (
offset: (-4.5, -29.0, -8.0),
central: ("npc.wyvern_flame.male.tail_rear"),
)
),
})

View File

@ -251,4 +251,88 @@
lateral: ("npc.roc.male.foot_r"),
)
),
(FlameWyvern, Male): (
wing_in_l: (
offset: (-24.0, -9.0, -4.0),
lateral: ("npc.wyvern_flame.male.wing_in_r"),
),
wing_in_r: (
offset: (0.0, -9.0, -4.0),
lateral: ("npc.wyvern_flame.male.wing_in_r"),
),
wing_mid_l: (
offset: (-17.0, -27.0, -2.0),
lateral: ("npc.wyvern_flame.male.wing_mid_r"),
),
wing_mid_r: (
offset: (0.0, -27.0, -2.0),
lateral: ("npc.wyvern_flame.male.wing_mid_r"),
),
wing_out_l: (
offset: (-18.0, -27.0, -2.0),
lateral: ("npc.wyvern_flame.male.wing_out_r"),
),
wing_out_r: (
offset: (0.0, -27.0, -2.0),
lateral: ("npc.wyvern_flame.male.wing_out_r"),
),
leg_l: (
offset: (-3.0, -4.5, -8.0),
lateral: ("npc.wyvern_flame.male.leg_r"),
),
leg_r: (
offset: (-3.0, -4.5, -8.0),
lateral: ("npc.wyvern_flame.male.leg_r"),
),
foot_l: (
offset: (-3.5, -6.5, -13.0),
lateral: ("npc.wyvern_flame.male.foot_r"),
),
foot_r: (
offset: (-3.5, -6.5, -13.0),
lateral: ("npc.wyvern_flame.male.foot_r"),
)
),
(FlameWyvern, Female): (
wing_in_l: (
offset: (-24.0, -9.0, -4.0),
lateral: ("npc.wyvern_flame.male.wing_in_r"),
),
wing_in_r: (
offset: (0.0, -9.0, -4.0),
lateral: ("npc.wyvern_flame.male.wing_in_r"),
),
wing_mid_l: (
offset: (-17.0, -27.0, -2.0),
lateral: ("npc.wyvern_flame.male.wing_mid_r"),
),
wing_mid_r: (
offset: (0.0, -27.0, -2.0),
lateral: ("npc.wyvern_flame.male.wing_mid_r"),
),
wing_out_l: (
offset: (-18.0, -27.0, -2.0),
lateral: ("npc.wyvern_flame.male.wing_out_r"),
),
wing_out_r: (
offset: (0.0, -27.0, -2.0),
lateral: ("npc.wyvern_flame.male.wing_out_r"),
),
leg_l: (
offset: (-3.0, -4.5, -8.0),
lateral: ("npc.wyvern_flame.male.leg_r"),
),
leg_r: (
offset: (-3.0, -4.5, -8.0),
lateral: ("npc.wyvern_flame.male.leg_r"),
),
foot_l: (
offset: (-3.5, -6.5, -13.0),
lateral: ("npc.wyvern_flame.male.foot_r"),
),
foot_r: (
offset: (-3.5, -6.5, -13.0),
lateral: ("npc.wyvern_flame.male.foot_r"),
)
),
})

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/beak.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/chest.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/foot_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/head.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/leg_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/neck.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/tail_front.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/tail_rear.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/wing_in_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/wing_mid_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/wyvern_flame/male/wing_out_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -147,14 +147,6 @@ impl<
const EXTENSION: &'static str = "ron";
}
// Utility enum used to build Stadium points
// Read doc for [Body::sausage] for more.
//
// Actually can be removed I guess?
// We can just determine shape form dimensions.
//
// But I want Dachshund in Veloren at least somewhere XD
impl Body {
pub fn is_humanoid(&self) -> bool { matches!(self, Body::Humanoid(_)) }
@ -492,6 +484,7 @@ impl Body {
bird_large::Species::Cockatrice => 4000,
bird_large::Species::Phoenix => 6000,
bird_large::Species::Roc => 5000,
bird_large::Species::FlameWyvern => 6000,
},
Body::Humanoid(_) => 750,
_ => 1000,
@ -746,7 +739,9 @@ impl Body {
Body::QuadrupedLow(q) => matches!(q.species, quadruped_low::Species::Lavadrake),
Body::BirdLarge(b) => matches!(
b.species,
bird_large::Species::Phoenix | bird_large::Species::Cockatrice
bird_large::Species::Phoenix
| bird_large::Species::Cockatrice
| bird_large::Species::FlameWyvern
),
_ => false,
},

View File

@ -37,6 +37,7 @@ make_case_elim!(
Phoenix = 0,
Cockatrice = 1,
Roc = 2,
FlameWyvern = 3,
}
);
@ -48,6 +49,7 @@ pub struct AllSpecies<SpeciesMeta> {
pub phoenix: SpeciesMeta,
pub cockatrice: SpeciesMeta,
pub roc: SpeciesMeta,
pub wyvern_flame: SpeciesMeta,
}
impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta> {
@ -59,11 +61,17 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
Species::Phoenix => &self.phoenix,
Species::Cockatrice => &self.cockatrice,
Species::Roc => &self.roc,
Species::FlameWyvern => &self.wyvern_flame,
}
}
}
pub const ALL_SPECIES: [Species; 3] = [Species::Phoenix, Species::Cockatrice, Species::Roc];
pub const ALL_SPECIES: [Species; 4] = [
Species::Phoenix,
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

@ -343,9 +343,9 @@ fn default_main_tool(body: &Body) -> Item {
)),
},
Body::BirdLarge(bird_large) => match (bird_large.species, bird_large.body_type) {
(bird_large::Species::Cockatrice, _) => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.birdlargebreathe",
)),
(bird_large::Species::Cockatrice | bird_large::Species::FlameWyvern, _) => Some(
Item::new_from_asset_expect("common.items.npc_weapons.unique.birdlargebreathe"),
),
(bird_large::Species::Phoenix, _) => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.birdlargefire",
)),

View File

@ -12,6 +12,7 @@ use crate::{
behavior::{CharacterBehavior, JoinData},
utils::*,
},
terrain::Block,
uid::Uid,
util::Dir,
};
@ -160,9 +161,16 @@ impl CharacterBehavior for Data {
))
.prerotated(pitch)
};
// Velocity relative to the current ground
let rel_vel = data.vel.0 - data.physics.ground_vel;
// Gets offsets
let body_offsets =
beam_offsets(data.body, data.inputs.look_dir, update.ori.look_vec());
let body_offsets = beam_offsets(
data.body,
data.inputs.look_dir,
update.ori.look_vec(),
rel_vel,
data.physics.on_ground,
);
let pos = Pos(data.pos.0 + body_offsets);
// Create beam segment
@ -219,9 +227,17 @@ impl CharacterBehavior for Data {
}
}
fn height_offset(body: &Body, look_dir: Dir) -> f32 {
fn height_offset(body: &Body, look_dir: Dir, velocity: Vec3<f32>, on_ground: Option<Block>) -> f32 {
match body {
Body::BirdLarge(_) => body.height() * 0.8,
// Hack to make the beam offset correspond to the animation
Body::BirdLarge(_) => {
body.height() * 0.3
+ if on_ground.is_none() {
(2.0 - velocity.xy().magnitude() * 0.25).max(-1.0)
} else {
0.0
}
},
Body::Golem(_) => {
const DIR_COEFF: f32 = 2.0;
body.height() * 0.9 + look_dir.z * DIR_COEFF
@ -234,10 +250,24 @@ fn height_offset(body: &Body, look_dir: Dir) -> f32 {
}
}
pub fn beam_offsets(body: &Body, look_dir: Dir, ori: Vec3<f32>) -> Vec3<f32> {
let body_radius = body.min_radius();
let body_offsets_z = height_offset(body, look_dir);
pub fn beam_offsets(
body: &Body,
look_dir: Dir,
ori: Vec3<f32>,
velocity: Vec3<f32>,
on_ground: Option<Block>,
) -> Vec3<f32> {
let dim = body.dimensions();
// The width (shoulder to shoulder) and length (nose to tail)
let (width, length) = (dim.x, dim.y);
let body_radius = if length > width {
// Dachshund-like
body.max_radius()
} else {
// Cyclops-like
body.min_radius()
};
let body_offsets_z = height_offset(body, look_dir, velocity, on_ground);
Vec3::new(
body_radius * ori.x * 1.1,
body_radius * ori.y * 1.1,

View File

@ -1884,6 +1884,9 @@ impl<'a> AgentData<'a> {
body,
controller.inputs.look_dir,
self.ori.look_vec(),
// Try to match animation by getting some context
self.vel.0 - self.physics_state.ground_vel,
self.physics_state.on_ground,
)
});
let aim_to = Vec3::new(

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,25 +55,25 @@ impl Animation for AlphaAnimation {
0.0
} * 1.3;
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
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);
@ -81,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,13 +52,6 @@ impl Animation for BreatheAnimation {
let wave_slow_cos = (anim_time * 4.5).cos();
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
@ -65,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 =
@ -76,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);
@ -104,28 +101,21 @@ 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;
next.neck.orientation = Quaternion::rotation_x(
movement1abs * -0.4
+ movement2abs * (-0.5 + velocity.xy().magnitude() * 0.2).min(0.0),
);
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 + velocity.xy().magnitude() * 0.2).min(0.0)
+ look_dir.z * 0.4,
);
}
next

View File

@ -39,13 +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.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
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 = 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;
@ -58,12 +58,15 @@ impl Animation for FlyAnimation {
0.0
} * 1.3;
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
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.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation =
@ -98,15 +101,21 @@ impl Animation for FlyAnimation {
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(-flap3 * 1.2 - 0.3);
next.wing_out_r.orientation = Quaternion::rotation_y(flap3 * 1.2 + 0.3);
if s_a.wyvern {
next.wing_out_l.orientation = Quaternion::rotation_y(-flap3 * 0.6 - 0.3);
next.wing_out_r.orientation = Quaternion::rotation_y(flap3 * 0.6 + 0.3);
} else {
next.wing_out_l.orientation = Quaternion::rotation_y(-flap3 * 1.2 - 0.3);
next.wing_out_r.orientation = Quaternion::rotation_y(flap3 * 1.2 + 0.3);
}
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 + 0.1) * 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 + 0.15) * Quaternion::rotation_z(-tilt * 0.8);
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);
next.leg_l.orientation = Quaternion::rotation_x(
@ -151,10 +160,10 @@ 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(0.04 - 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(slow * 0.08) * Quaternion::rotation_z(-tilt * 0.8);
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);
next.leg_l.orientation = Quaternion::rotation_x(-1.2 + slow * -0.05)

View File

@ -37,49 +37,22 @@ impl Animation for IdleAnimation {
);
let wave_slow_cos = (anim_time * 4.5).cos();
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 + 1.5);
next.chest.orientation = Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
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.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
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(duck_head_look.x)
* Quaternion::rotation_x(-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(wave_slow_cos * -0.02 - 0.02);
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.6);
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);
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(-0.8 + wave_slow_cos * 0.06) * Quaternion::rotation_z(0.2);
next.wing_in_r.orientation =
Quaternion::rotation_y(0.8 - wave_slow_cos * 0.06) * 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_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.4) * Quaternion::rotation_z(0.2);
next.wing_out_r.orientation = Quaternion::rotation_y(0.4) * Quaternion::rotation_z(-0.2);
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);
@ -90,6 +63,82 @@ impl Animation for IdleAnimation {
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);
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;
next.chest.orientation = Quaternion::rotation_x(-0.1);
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.4 - duck_head_look.y.abs() + wave_slow_cos * 0.01);
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.38);
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.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(-0.8 + wave_slow_cos * 0.06) * Quaternion::rotation_z(0.4);
next.wing_in_r.orientation =
Quaternion::rotation_y(0.8 - wave_slow_cos * 0.06) * Quaternion::rotation_z(-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_x(0.1)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.7);
next.wing_mid_r.orientation = Quaternion::rotation_x(0.1)
* 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_x(0.0)
* Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(0.55);
next.wing_out_r.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-0.1)
* 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;
next.chest.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(duck_head_look.x)
* Quaternion::rotation_x(-duck_head_look.y.abs() + wave_slow_cos * 0.01);
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.6);
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);
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(-0.8 + wave_slow_cos * 0.06) * Quaternion::rotation_z(0.2);
next.wing_in_r.orientation =
Quaternion::rotation_y(0.8 - wave_slow_cos * 0.06) * 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_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.4) * Quaternion::rotation_z(0.2);
next.wing_out_r.orientation =
Quaternion::rotation_y(0.4) * Quaternion::rotation_z(-0.2);
}
next
}
}

View File

@ -124,6 +124,7 @@ pub struct SkeletonAttr {
foot: (f32, f32, f32),
scaler: f32,
feed: f32,
wyvern: bool,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -153,6 +154,7 @@ impl Default for SkeletonAttr {
foot: (0.0, 0.0, 0.0),
scaler: 0.0,
feed: 0.0,
wyvern: false,
}
}
}
@ -165,67 +167,81 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Phoenix, _) => (2.5, 16.0),
(Cockatrice, _) => (2.5, 16.0),
(Roc, _) => (2.5, 27.5),
(FlameWyvern, _) => (2.5, 20.5),
},
neck: match (body.species, body.body_type) {
(Phoenix, _) => (2.5, -5.5),
(Cockatrice, _) => (5.0, -1.5),
(Roc, _) => (9.5, -1.5),
(FlameWyvern, _) => (11.0, -0.5),
},
head: match (body.species, body.body_type) {
(Phoenix, _) => (6.0, 12.0),
(Cockatrice, _) => (8.0, 4.5),
(Roc, _) => (17.0, -3.5),
(FlameWyvern, _) => (10.0, -1.5),
},
beak: match (body.species, body.body_type) {
(Phoenix, _) => (5.0, 3.0),
(Cockatrice, _) => (2.0, -3.0),
(Roc, _) => (0.0, -3.0),
(FlameWyvern, _) => (-1.0, 2.0),
},
tail_front: match (body.species, body.body_type) {
(Phoenix, _) => (-9.5, -1.0),
(Cockatrice, _) => (-5.0, -2.5),
(Roc, _) => (-7.5, -3.5),
(FlameWyvern, _) => (-10.0, -5.0),
},
tail_rear: match (body.species, body.body_type) {
(Phoenix, _) => (-11.0, 0.0),
(Cockatrice, _) => (-8.0, -3.0),
(Roc, _) => (-8.0, -3.0),
(FlameWyvern, _) => (-11.0, -1.0),
},
wing_in: match (body.species, body.body_type) {
(Phoenix, _) => (3.0, 2.5, 2.0),
(Cockatrice, _) => (3.5, 7.0, 3.5),
(Roc, _) => (5.5, 7.5, -1.0),
(FlameWyvern, _) => (5.5, 5.0, -2.0),
},
wing_mid: match (body.species, body.body_type) {
(Phoenix, _) => (10.0, 1.0, 0.0),
(Cockatrice, _) => (6.0, 0.0, 0.0),
(Roc, _) => (12.0, 1.0, -0.5),
(FlameWyvern, _) => (19.0, 15.0, -1.0),
},
wing_out: match (body.species, body.body_type) {
(Phoenix, _) => (7.0, 2.0, 1.5),
(Cockatrice, _) => (4.0, -1.0, 1.0),
(Roc, _) => (10.0, -2.0, 0.0),
(FlameWyvern, _) => (16.0, -3.0, 0.0),
},
leg: match (body.species, body.body_type) {
(Phoenix, _) => (4.0, 1.5, 12.0),
(Cockatrice, _) => (3.5, 2.5, 13.0),
(Roc, _) => (5.5, -1.5, 17.5),
(FlameWyvern, _) => (5.5, -2.0, 15.5),
},
foot: match (body.species, body.body_type) {
(Phoenix, _) => (0.5, -0.5, -2.5),
(Cockatrice, _) => (0.5, -3.0, -3.0),
(Roc, _) => (2.5, -2.5, -5.5),
(FlameWyvern, _) => (0.5, 0.0, -3.5),
},
scaler: match (body.species, body.body_type) {
(Phoenix, _) => (1.0),
(Cockatrice, _) => (1.0),
(Roc, _) => (1.0),
(FlameWyvern, _) => (1.0),
},
feed: match (body.species, body.body_type) {
(Phoenix, _) => (-0.65),
(Cockatrice, _) => (-0.5),
(Roc, _) => (-0.4),
(FlameWyvern, _) => (-0.65),
},
wyvern: matches!((body.species, body.body_type), (FlameWyvern, _)),
}
}
}

View File

@ -7,7 +7,7 @@ use core::f32::consts::PI;
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency<'a> = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f32);
type Dependency<'a> = (Vec3<f32>, Vec3<f32>, Vec3<f32>, Vec3<f32>, f32);
type Skeleton = BirdLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,7 +16,7 @@ impl Animation for RunAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_large_run")]
fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, acc_vel): Self::Dependency<'a>,
(velocity, orientation, last_ori, avg_vel, acc_vel): Self::Dependency<'a>,
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -64,13 +64,17 @@ impl Animation for RunAnimation {
} else {
0.0
} * 1.3;
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()) * speednorm;
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
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.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.scale = Vec3::one() * 0.99;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(-0.1 * speednorm + short * -0.05)
@ -85,61 +89,12 @@ impl Animation for RunAnimation {
* Quaternion::rotation_y(tilt * 0.1)
* Quaternion::rotation_z(shortalt * -0.1 - tilt * 0.5);
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
s_a.chest.1 + short * 0.5 + 0.5 * speednorm,
);
next.chest.orientation = Quaternion::rotation_x(short * 0.07)
* Quaternion::rotation_y(tilt * 0.8)
* 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(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(-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(-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);
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 + short * 0.05) * Quaternion::rotation_z(0.2);
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 + speednorm * 1.5,
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 + speednorm * -1.5,
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);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
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);
@ -148,10 +103,121 @@ 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);
if s_a.wyvern {
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + speednorm * -2.0,
) * s_a.scaler;
next.chest.orientation = Quaternion::rotation_x(-0.1 + short * 0.07 + x_tilt)
* Quaternion::rotation_y(tilt * 0.8)
* 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(0.3 + short * -0.02) * Quaternion::rotation_z(tilt * 2.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.1 + short * -0.1) * Quaternion::rotation_z(tilt * 0.8);
next.wing_in_l.position = Vec3::new(
-s_a.wing_in.0,
s_a.wing_in.1 + foot1a * 2.0,
s_a.wing_in.2 + speednorm * 1.0 + foot1b * 1.0,
);
next.wing_in_r.position = Vec3::new(
s_a.wing_in.0,
s_a.wing_in.1 + foot2a * 2.0,
s_a.wing_in.2 + speednorm * 1.0 + foot2b * 1.0,
);
next.wing_in_l.orientation = Quaternion::rotation_x(foot2a * -0.05 + speednorm * -0.3)
* Quaternion::rotation_y(-0.8 + speednorm * 0.55 + foot2b * -0.2)
* Quaternion::rotation_z(0.2 + foot2a * 0.6);
next.wing_in_r.orientation = Quaternion::rotation_x(foot1a * -0.05 + speednorm * -0.3)
* Quaternion::rotation_y(0.8 + speednorm * -0.55 + foot1b * 0.2)
* Quaternion::rotation_z(-0.2 + foot1a * -0.6);
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_x(0.1)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.7);
next.wing_mid_r.orientation = Quaternion::rotation_x(0.1)
* 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 + short * 0.05)
* Quaternion::rotation_z(0.3 + foot2a * 0.3);
next.wing_out_r.orientation = Quaternion::rotation_y(-0.2 + short * -0.05)
* Quaternion::rotation_z(-0.3 + foot1a * 0.3);
next.leg_l.position = Vec3::new(
-s_a.leg.0,
s_a.leg.1 + foot1b * -2.3,
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 + foot1b * -1.5,
);
next.leg_r.orientation = Quaternion::rotation_x(-1.0 * speednorm + foot2a * 0.15)
* Quaternion::rotation_y(tilt * 0.5);
} else {
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + 0.5 * speednorm,
) * s_a.scaler;
next.chest.orientation = Quaternion::rotation_x(short * 0.07 + x_tilt)
* Quaternion::rotation_y(tilt * 0.8)
* 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(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(-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(-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);
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 + short * 0.05) * Quaternion::rotation_z(0.2);
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);
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);
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
* Quaternion::rotation_y(tilt * 0.5);
}
next
}
}

View File

@ -38,13 +38,6 @@ impl Animation for ShockwaveAnimation {
let wave_slow_cos = (anim_time * 4.5).cos();
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
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,19 +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.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.chest.position = Vec3::new(
0.0,
s_a.chest.0,
@ -58,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,13 +37,6 @@ impl Animation for StunnedAnimation {
let twitch2 = mirror * (twitch * 20.0).sin() * pullback;
let movement1abs = movement1base * pullback;
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
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

@ -41,12 +41,15 @@ impl Animation for SwimAnimation {
let wave_fast = (anim_time * 6.0).sin();
let wave_fast_cos = (anim_time * 6.0).cos();
next.head.scale = Vec3::one() * 0.98;
next.neck.scale = Vec3::one() * 1.02;
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next.head.scale = Vec3::one() * 0.99;
next.neck.scale = Vec3::one() * 1.01;
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.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.5);
next.chest.orientation = Quaternion::rotation_x(0.0);

View File

@ -3336,6 +3336,9 @@ impl FigureMgr {
FigureState::new(renderer, BirdLargeSkeleton::default(), body)
});
// 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,
@ -3366,6 +3369,7 @@ impl FigureMgr {
// TODO: Update to use the quaternion.
ori * anim::vek::Vec3::<f32>::unit_y(),
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
rel_avg_vel,
state.acc_vel,
),
state.state_time,
@ -3427,6 +3431,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 +3470,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 +3497,7 @@ impl FigureMgr {
anim::bird_large::ShootAnimation::update_skeleton(
&target_base,
(
rel_vel,
time,
Some(s.stage_section),
state.state_time,