maneater and feed anim

This commit is contained in:
jshipsey 2020-07-28 22:44:47 -04:00
parent 90d7485c38
commit 5d2be2240e
21 changed files with 286 additions and 12 deletions

View File

@ -629,6 +629,10 @@
"pangolin": {
"keyword": "pangolin",
"generic": "Pangolin"
},
"maneater": {
"keyword": "maneater",
"generic": "Maneater"
}
}
}

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

View File

@ -416,4 +416,56 @@
central: ("npc.pangolin.male.tail_front"),
),
),
(Maneater, Male): (
upper: (
offset: (-5.5, 0.0, 0.0),
central: ("npc.maneater.male.head_upper"),
),
lower: (
offset: (-14.5, -5.5, -0.0),
central: ("npc.maneater.male.head_lower"),
),
jaw: (
offset: (-7.5, 0.0, -19.0),
central: ("npc.maneater.male.jaw"),
),
chest: (
offset: (-6.5, -6.5, -6.0),
central: ("npc.maneater.male.chest"),
),
tail_rear: (
offset: (-0.5, -14.0, -6.5),
central: ("npc.maneater.male.tail_rear"),
),
tail_front: (
offset: (-4.5, -15.0, -0.0),
central: ("npc.maneater.male.tail_front"),
),
),
(Maneater, Female): (
upper: (
offset: (-5.5, 0.0, 0.0),
central: ("npc.maneater.male.head_upper"),
),
lower: (
offset: (-14.5, -5.5, -0.0),
central: ("npc.maneater.male.head_lower"),
),
jaw: (
offset: (-7.5, 0.0, -19.0),
central: ("npc.maneater.male.jaw"),
),
chest: (
offset: (-6.5, -6.5, -6.0),
central: ("npc.maneater.male.chest"),
),
tail_rear: (
offset: (-0.5, -14.0, -6.5),
central: ("npc.maneater.male.tail_rear"),
),
tail_front: (
offset: (-4.5, -15.0, -0.0),
central: ("npc.maneater.male.tail_front"),
),
),
})

View File

@ -287,4 +287,40 @@
lateral: ("npc.pangolin.male.foot_br"),
),
),
(Maneater, Male): (
front_left: (
offset: (-6.0, 0.0, -6.5),
lateral: ("npc.maneater.male.foot_fl"),
),
front_right: (
offset: (-2.0, 0.0, -6.5),
lateral: ("npc.maneater.male.foot_fr"),
),
back_left: (
offset: (-6.0, -8.0, -9.0),
lateral: ("npc.maneater.male.foot_bl"),
),
back_right: (
offset: (-2.0, -8.0, -9.0),
lateral: ("npc.maneater.male.foot_br"),
),
),
(Maneater, Female): (
front_left: (
offset: (-6.0, 0.0, -6.5),
lateral: ("npc.maneater.male.foot_fl"),
),
front_right: (
offset: (-2.0, 0.0, -6.5),
lateral: ("npc.maneater.male.foot_fr"),
),
back_left: (
offset: (-6.0, -8.0, -9.0),
lateral: ("npc.maneater.male.foot_bl"),
),
back_right: (
offset: (-2.0, -8.0, -9.0),
lateral: ("npc.maneater.male.foot_br"),
),
),
})

View File

@ -60,7 +60,7 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
}
pub const ALL_SPECIES: [Species; 4] = [
Species::Ogre,
Species::Ogre,
Species::Cyclops,
Species::Wendigo,
Species::Troll,

View File

@ -36,6 +36,7 @@ pub enum Species {
Tortoise = 5,
Rocksnapper = 6,
Pangolin = 7,
Maneater = 8,
}
/// Data representing per-species generic data.
@ -51,6 +52,7 @@ pub struct AllSpecies<SpeciesMeta> {
pub tortoise: SpeciesMeta,
pub rocksnapper: SpeciesMeta,
pub pangolin: SpeciesMeta,
pub maneater: SpeciesMeta,
}
impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta> {
@ -67,11 +69,12 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
Species::Tortoise => &self.tortoise,
Species::Rocksnapper => &self.rocksnapper,
Species::Pangolin => &self.pangolin,
Species::Maneater => &self.maneater,
}
}
}
pub const ALL_SPECIES: [Species; 8] = [
pub const ALL_SPECIES: [Species; 9] = [
Species::Crocodile,
Species::Alligator,
Species::Salamander,
@ -80,6 +83,7 @@ pub const ALL_SPECIES: [Species; 8] = [
Species::Tortoise,
Species::Rocksnapper,
Species::Pangolin,
Species::Maneater,
];
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {

View File

@ -148,7 +148,7 @@ pub fn attempt_wield(data: &JoinData, update: &mut StateUpdate) {
/// Checks that player can `Sit` and updates `CharacterState` if so
pub fn attempt_sit(data: &JoinData, update: &mut StateUpdate) {
if data.physics.on_ground && data.body.is_humanoid() {
if data.physics.on_ground {
update.character = CharacterState::Sit;
}
}

View File

@ -142,6 +142,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (5.0, 1.0),
(Rocksnapper, _) => (6.0, 0.5),
(Pangolin, _) => (-0.5, 8.0),
(Maneater, _) => (6.0, 9.5),
},
head_lower: match (body.species, body.body_type) {
(Crocodile, _) => (8.0, 0.0),
@ -152,6 +153,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (12.0, -3.5),
(Rocksnapper, _) => (12.0, -9.0),
(Pangolin, _) => (8.0, -9.0),
(Maneater, _) => (1.0, 4.5),
},
jaw: match (body.species, body.body_type) {
(Crocodile, _) => (2.5, -3.0),
@ -162,6 +164,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (-3.5, -2.0),
(Rocksnapper, _) => (-5.0, -1.5),
(Pangolin, _) => (0.0, 0.0),
(Maneater, _) => (-1.0, 4.0),
},
chest: match (body.species, body.body_type) {
(Crocodile, _) => (0.0, 5.0),
@ -172,6 +175,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (0.0, 11.0),
(Rocksnapper, _) => (0.0, 18.5),
(Pangolin, _) => (0.0, 7.0),
(Maneater, _) => (0.0, 12.0),
},
tail_rear: match (body.species, body.body_type) {
(Crocodile, _) => (-12.5, -1.0),
@ -182,6 +186,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (-10.0, -1.5),
(Rocksnapper, _) => (-14.5, -2.0),
(Pangolin, _) => (-7.0, -3.0),
(Maneater, _) => (-15.0, 4.0),
},
tail_front: match (body.species, body.body_type) {
(Crocodile, _) => (-6.0, 0.0),
@ -192,6 +197,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (-13.0, -3.5),
(Rocksnapper, _) => (-13.5, -6.5),
(Pangolin, _) => (-7.5, -0.5),
(Maneater, _) => (-1.0, 4.0),
},
feet_f: match (body.species, body.body_type) {
(Crocodile, _) => (3.5, 6.0, -1.0),
@ -202,6 +208,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (5.5, 6.5, -3.0),
(Rocksnapper, _) => (7.5, 5.0, -8.5),
(Pangolin, _) => (5.5, 5.5, -1.0),
(Maneater, _) => (4.5, 4.0, -5.5),
},
feet_b: match (body.species, body.body_type) {
(Crocodile, _) => (3.5, -6.0, -1.0),
@ -212,6 +219,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (5.5, -11.5, -3.0),
(Rocksnapper, _) => (8.0, -12.0, -9.5),
(Pangolin, _) => (6.5, -3.5, -1.0),
(Maneater, _) => (4.5, -2.5, -3.0),
},
lean: match (body.species, body.body_type) {
(Pangolin, _) => (0.4, 0.0),
@ -226,6 +234,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (1.0),
(Rocksnapper, _) => (1.4),
(Pangolin, _) => (1.3),
(Maneater, _) => (1.4),
},
tempo: match (body.species, body.body_type) {
(Crocodile, _) => (0.8),
@ -236,6 +245,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Tortoise, _) => (0.9),
(Rocksnapper, _) => (0.9),
(Pangolin, _) => (1.15),
(Maneater, _) => (1.0),
},
}
}

View File

@ -107,7 +107,7 @@ impl Animation for RunAnimation {
skeleton_attr.tail_front.1 + skeleton_attr.lean.0 * 2.0,
);
next.tail_front.ori =
Quaternion::rotation_z(shortalt * 0.18 * skeleton_attr.lean.0 + tilt * 1.8)
Quaternion::rotation_z(shortalt * 0.18 * skeleton_attr.lean.1 + tilt * 1.8)
* Quaternion::rotation_y(shortalt * 0.1)
* Quaternion::rotation_x(0.06 - skeleton_attr.lean.0 * 1.2 + x_tilt * 0.2);
next.tail_front.scale = Vec3::one();
@ -118,7 +118,7 @@ impl Animation for RunAnimation {
skeleton_attr.tail_rear.1 + shortalt * 0.6,
);
next.tail_rear.ori =
Quaternion::rotation_z(shortalt * 0.25 * skeleton_attr.lean.0 + tilt * 1.6)
Quaternion::rotation_z(shortalt * 0.25 * skeleton_attr.lean.1 + tilt * 1.6)
* Quaternion::rotation_y(shortalt * 0.1)
* Quaternion::rotation_x(-0.04 + x_tilt * 0.5);
next.tail_rear.scale = Vec3::one();
@ -156,7 +156,7 @@ impl Animation for RunAnimation {
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + foothorilb * -1.0,
skeleton_attr.feet_b.2 + 1.0 + ((footvertlb * -1.2).max(-0.0)),
skeleton_attr.feet_b.2 + ((footvertlb * -1.2).max(-0.0)),
);
next.foot_bl.ori = Quaternion::rotation_x(-0.2 + footvertlb * -0.5 - skeleton_attr.lean.0)
* Quaternion::rotation_y(tilt * -1.0)
@ -166,7 +166,7 @@ impl Animation for RunAnimation {
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + foothorirb * -1.0,
skeleton_attr.feet_b.2 + 1.0 + ((footvertrb * -1.2).max(-0.0)),
skeleton_attr.feet_b.2 + ((footvertrb * -1.2).max(-0.0)),
);
next.foot_br.ori = Quaternion::rotation_x(-0.2 + footvertrb * -0.5 - skeleton_attr.lean.0)
* Quaternion::rotation_y(tilt * -1.0)

View File

@ -0,0 +1,100 @@
use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr};
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct FeedAnimation;
impl Animation for FeedAnimation {
type Dependency = f64;
type Skeleton = QuadrupedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_small_feed\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_small_feed")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 5.0).sin();
let quick = (anim_time as f32 * 14.0).sin();
let slow_alt = (anim_time as f32 * 3.5 + PI).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 1.0,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.5,
);
next.head.offset = Vec3::new(
0.0,
skeleton_attr.head.0 + 1.5,
skeleton_attr.head.1 + slow * 0.2,
);
next.head.ori = Quaternion::rotation_z(head_look.y)
* Quaternion::rotation_x(slow * 0.05 + quick * 0.08 - 0.4 * skeleton_attr.feed);
next.head.scale = Vec3::one();
next.chest.offset = Vec3::new(slow * 0.02, skeleton_attr.chest.0, skeleton_attr.chest.1)
/ 11.0
* skeleton_attr.scaler;
next.chest.ori = Quaternion::rotation_x(-0.35 * skeleton_attr.feed)
* Quaternion::rotation_y(head_look.y * 0.1);
next.chest.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.leg_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + 0.5,
);
next.leg_fl.ori = Quaternion::rotation_x(slow * 0.01 + 0.25 * skeleton_attr.feed)
* Quaternion::rotation_y(slow * -0.02 - head_look.y * 0.1);
next.leg_fl.scale = Vec3::one();
next.leg_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + 0.5,
);
next.leg_fr.ori = Quaternion::rotation_x(slow_alt * 0.01 + 0.25 * skeleton_attr.feed)
* Quaternion::rotation_y(slow * -0.02 - head_look.y * 0.1);
next.leg_fr.scale = Vec3::one();
next.leg_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + 1.0,
skeleton_attr.feet_b.2 - 1.0,
);
next.leg_bl.ori = Quaternion::rotation_x(slow_alt * 0.01 + 0.15 * skeleton_attr.feed)
* Quaternion::rotation_y(slow * -0.02 - head_look.y * 0.1);
next.leg_bl.scale = Vec3::one();
next.leg_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + 1.0,
skeleton_attr.feet_b.2 - 1.0,
);
next.leg_br.ori = Quaternion::rotation_x(slow * 0.01 + 0.15 * skeleton_attr.feed)
* Quaternion::rotation_y(slow * -0.02 - head_look.y * 0.1);
next.leg_br.scale = Vec3::one();
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.ori = Quaternion::rotation_z(slow * 0.3 + head_look.y * 0.3);
next.tail.scale = Vec3::one();
next
}
}

View File

@ -1,9 +1,10 @@
pub mod feed;
pub mod idle;
pub mod jump;
pub mod run;
// Reexports
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
pub use self::{feed::FeedAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
use super::{Bone, FigureBoneData, Skeleton};
use common::comp::{self};
@ -80,6 +81,7 @@ pub struct SkeletonAttr {
maximize: f32,
minimize: f32,
spring: f32,
feed: f32,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
type Error = ();
@ -105,6 +107,7 @@ impl Default for SkeletonAttr {
maximize: 0.0,
minimize: 0.0,
spring: 0.0,
feed: 0.0,
}
}
}
@ -149,7 +152,7 @@ impl<'a> From<&'a comp::quadruped_small::Body> for SkeletonAttr {
},
feet_f: match (body.species, body.body_type) {
(Pig, _) => (4.5, 3.0, -2.0),
(Fox, _) => (3.0, 5.0, -5.0),
(Fox, _) => (3.0, 5.0, -5.5),
(Sheep, _) => (3.5, 2.0, -2.0),
(Boar, _) => (3.5, 6.0, -5.5),
(Jackalope, _) => (3.0, 4.0, -2.0),
@ -166,7 +169,7 @@ impl<'a> From<&'a comp::quadruped_small::Body> for SkeletonAttr {
},
feet_b: match (body.species, body.body_type) {
(Pig, _) => (3.5, -2.0, -1.5),
(Fox, _) => (3.0, -3.0, -2.0),
(Fox, _) => (3.0, -3.0, -3.0),
(Sheep, _) => (3.5, -3.5, -2.0),
(Boar, _) => (3.0, -3.0, -2.5),
(Jackalope, _) => (3.5, -2.0, 0.0),
@ -283,6 +286,23 @@ impl<'a> From<&'a comp::quadruped_small::Body> for SkeletonAttr {
(Rabbit, _) => (2.5),
(Truffler, _) => (0.8),
},
feed: match (body.species, body.body_type) {
(Pig, _) => (1.0),
(Fox, _) => (1.0),
(Sheep, _) => (1.0),
(Boar, _) => (0.6),
(Jackalope, _) => (1.0),
(Skunk, _) => (0.8),
(Cat, _) => (1.0),
(Batfox, _) => (0.7),
(Raccoon, _) => (0.8),
(Quokka, _) => (1.0),
(Dodarock, _) => (0.7),
(Holladon, _) => (1.0),
(Hyena, _) => (1.0),
(Rabbit, _) => (1.2),
(Truffler, _) => (0.6),
},
}
}
}

View File

@ -947,11 +947,29 @@ impl FigureMgr {
&mut state_animation_rate,
skeleton_attr,
),
_ => anim::quadruped_small::IdleAnimation::update_skeleton(
&QuadrupedSmallSkeleton::new(),
time,
state.state_time,
&mut state_animation_rate,
skeleton_attr,
),
};
let target_bones = match &character {
CharacterState::Sit { .. } => {
anim::quadruped_small::FeedAnimation::update_skeleton(
&target_base,
time,
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
},
// TODO!
_ => state.skeleton_mut().clone(),
_ => target_base,
};
state.skeleton.interpolate(&target_base, dt);
state.skeleton.interpolate(&target_bones, dt);
state.update(
renderer,
pos.0,