mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
gnome
This commit is contained in:
parent
266986626d
commit
7cf723bb9d
@ -889,9 +889,9 @@
|
|||||||
]
|
]
|
||||||
),
|
),
|
||||||
species: (
|
species: (
|
||||||
clownfish: (
|
gnome: (
|
||||||
keyword: "gremlin",
|
keyword: "gnome",
|
||||||
generic: "Gremlin"
|
generic: "Gnome"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -1,46 +1,46 @@
|
|||||||
({
|
({
|
||||||
(Gremlin, Male): (
|
(Gnome, Male): (
|
||||||
head: (
|
head: (
|
||||||
offset: (-1.5, -7.5, -5.0),
|
offset: (-8.0, -6.5, -12.0),
|
||||||
central: ("npc.gremlin.male.chest"),
|
central: ("npc.gnome.male.head"),
|
||||||
),
|
),
|
||||||
chest: (
|
chest: (
|
||||||
offset: (-1.5, -7.5, -5.0),
|
offset: (-5.0, -3.0, -2.5),
|
||||||
central: ("npc.gremlin.male.chest"),
|
central: ("npc.gnome.male.chest"),
|
||||||
),
|
),
|
||||||
shorts: (
|
shorts: (
|
||||||
offset: (-1.5, -7.5, -5.0),
|
offset: (-4.0, -3.5, -2.5),
|
||||||
central: ("npc.gremlin.male.chest"),
|
central: ("npc.gnome.male.shorts"),
|
||||||
),
|
),
|
||||||
tail: (
|
tail: (
|
||||||
offset: (-0.5, -5.0, -2.5),
|
offset: (-0.5, -5.0, -2.5),
|
||||||
central: ("npc.gremlin.male.tail"),
|
central: ("armor.empty"),
|
||||||
),
|
),
|
||||||
main: (
|
main: (
|
||||||
offset: (-1.5, -7.5, -5.0),
|
offset: (-1.5, -7.5, -5.0),
|
||||||
central: ("npc.gremlin.male.chest"),
|
central: ("armor.empty"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(Gremlin, Female): (
|
(Gnome, Female): (
|
||||||
head: (
|
head: (
|
||||||
offset: (-1.5, -7.5, -5.0),
|
offset: (-8.0, -6.5, -12.0),
|
||||||
central: ("npc.gremlin.male.chest"),
|
central: ("npc.gnome.male.head"),
|
||||||
),
|
),
|
||||||
chest: (
|
chest: (
|
||||||
offset: (-1.5, -7.5, -5.0),
|
offset: (-5.0, -3.0, -2.5),
|
||||||
central: ("npc.gremlin.male.chest"),
|
central: ("npc.gnome.male.chest"),
|
||||||
),
|
),
|
||||||
shorts: (
|
shorts: (
|
||||||
offset: (-1.5, -7.5, -5.0),
|
offset: (-4.0, -3.5, -2.5),
|
||||||
central: ("npc.gremlin.male.chest"),
|
central: ("npc.gnome.male.shorts"),
|
||||||
),
|
),
|
||||||
tail: (
|
tail: (
|
||||||
offset: (-0.5, -5.0, -2.5),
|
offset: (-0.5, -5.0, -2.5),
|
||||||
central: ("npc.gremlin.male.tail"),
|
central: ("armor.empty"),
|
||||||
),
|
),
|
||||||
main: (
|
main: (
|
||||||
offset: (-1.5, -7.5, -5.0),
|
offset: (-1.5, -7.5, -5.0),
|
||||||
central: ("npc.gremlin.male.chest"),
|
central: ("armor.empty"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
({
|
({
|
||||||
(Gremlin, Male): (
|
(Gnome, Male): (
|
||||||
hand_l: (
|
hand_l: (
|
||||||
offset: (-0.5, -3.0, -4.0),
|
offset: (-2.0, -2.0, -5.0),
|
||||||
lateral: ("npc.gremlin.male.hand_l"),
|
lateral: ("npc.gnome.male.hand_l"),
|
||||||
),
|
),
|
||||||
hand_r: (
|
hand_r: (
|
||||||
offset: (-0.5, -3.0, -4.0),
|
offset: (-2.0, -2.0, -5.0),
|
||||||
lateral: ("npc.gremlin.male.hand_r"),
|
lateral: ("npc.gnome.male.hand_r"),
|
||||||
),
|
),
|
||||||
foot_l: (
|
foot_l: (
|
||||||
offset: (-0.5, -3.0, -4.0),
|
offset: (-1.5, -2.0, -4.0),
|
||||||
lateral: ("npc.gremlin.male.fooot_l"),
|
lateral: ("npc.gnome.male.foot_l"),
|
||||||
),
|
),
|
||||||
foot_r: (
|
foot_r: (
|
||||||
offset: (-0.5, -3.0, -4.0),
|
offset: (-1.5, -2.0, -4.0),
|
||||||
lateral: ("npc.gremlin.male.foot_r"),
|
lateral: ("npc.gnome.male.foot_r"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(Gremlin, Female): (
|
(Gnome, Female): (
|
||||||
hand_l: (
|
hand_l: (
|
||||||
offset: (-0.5, -3.0, -4.0),
|
offset: (-2.0, -2.0, -5.0),
|
||||||
lateral: ("npc.gremlin.male.hand_l"),
|
lateral: ("npc.gnome.male.hand_l"),
|
||||||
),
|
),
|
||||||
hand_r: (
|
hand_r: (
|
||||||
offset: (-0.5, -3.0, -4.0),
|
offset: (-2.0, -2.0, -5.0),
|
||||||
lateral: ("npc.gremlin.male.hand_r"),
|
lateral: ("npc.gnome.male.hand_r"),
|
||||||
),
|
),
|
||||||
foot_l: (
|
foot_l: (
|
||||||
offset: (-0.5, -3.0, -4.0),
|
offset: (-1.5, -2.0, -4.0),
|
||||||
lateral: ("npc.gremlin.male.fooot_l"),
|
lateral: ("npc.gnome.male.foot_l"),
|
||||||
),
|
),
|
||||||
foot_r: (
|
foot_r: (
|
||||||
offset: (-0.5, -3.0, -4.0),
|
offset: (-1.5, -2.0, -4.0),
|
||||||
lateral: ("npc.gremlin.male.foot_r"),
|
lateral: ("npc.gnome.male.foot_r"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
BIN
assets/voxygen/voxel/npc/gnome/male/chest.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/gnome/male/chest.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/gnome/male/foot_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/gnome/male/foot_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/gnome/male/foot_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/gnome/male/foot_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/gnome/male/hand_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/gnome/male/hand_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/gnome/male/hand_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/gnome/male/hand_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/gnome/male/head.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/gnome/male/head.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/gnome/male/shorts.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/gnome/male/shorts.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -34,7 +34,7 @@ make_case_elim!(
|
|||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum Species {
|
pub enum Species {
|
||||||
Gremlin = 0,
|
Gnome = 0,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ make_case_elim!(
|
|||||||
/// NOTE: Deliberately don't (yet?) implement serialize.
|
/// NOTE: Deliberately don't (yet?) implement serialize.
|
||||||
#[derive(Clone, Debug, Deserialize)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
pub struct AllSpecies<SpeciesMeta> {
|
pub struct AllSpecies<SpeciesMeta> {
|
||||||
pub gremlin: SpeciesMeta,
|
pub gnome: SpeciesMeta,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta> {
|
impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta> {
|
||||||
@ -52,12 +52,12 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn index(&self, &index: &'a Species) -> &Self::Output {
|
fn index(&self, &index: &'a Species) -> &Self::Output {
|
||||||
match index {
|
match index {
|
||||||
Species::Gremlin => &self.gremlin,
|
Species::Gnome => &self.gnome,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const ALL_SPECIES: [Species; 1] = [Species::Gremlin];
|
pub const ALL_SPECIES: [Species; 1] = [Species::Gnome];
|
||||||
|
|
||||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||||
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||||
|
@ -16,7 +16,7 @@ pub enum NpcKind {
|
|||||||
Clownfish,
|
Clownfish,
|
||||||
Marlin,
|
Marlin,
|
||||||
Ogre,
|
Ogre,
|
||||||
Gremlin,
|
Gnome,
|
||||||
Archaeos,
|
Archaeos,
|
||||||
StoneGolem,
|
StoneGolem,
|
||||||
Reddragon,
|
Reddragon,
|
||||||
@ -31,7 +31,7 @@ pub const ALL_NPCS: [NpcKind; 12] = [
|
|||||||
NpcKind::Clownfish,
|
NpcKind::Clownfish,
|
||||||
NpcKind::Marlin,
|
NpcKind::Marlin,
|
||||||
NpcKind::Ogre,
|
NpcKind::Ogre,
|
||||||
NpcKind::Gremlin,
|
NpcKind::Gnome,
|
||||||
NpcKind::Archaeos,
|
NpcKind::Archaeos,
|
||||||
NpcKind::StoneGolem,
|
NpcKind::StoneGolem,
|
||||||
NpcKind::Reddragon,
|
NpcKind::Reddragon,
|
||||||
@ -125,7 +125,7 @@ pub fn kind_to_body(kind: NpcKind) -> Body {
|
|||||||
NpcKind::Clownfish => comp::fish_small::Body::random().into(),
|
NpcKind::Clownfish => comp::fish_small::Body::random().into(),
|
||||||
NpcKind::Marlin => comp::fish_medium::Body::random().into(),
|
NpcKind::Marlin => comp::fish_medium::Body::random().into(),
|
||||||
NpcKind::Ogre => comp::biped_large::Body::random().into(),
|
NpcKind::Ogre => comp::biped_large::Body::random().into(),
|
||||||
NpcKind::Gremlin => comp::biped_small::Body::random().into(),
|
NpcKind::Gnome => comp::biped_small::Body::random().into(),
|
||||||
NpcKind::Archaeos => comp::theropod::Body::random().into(),
|
NpcKind::Archaeos => comp::theropod::Body::random().into(),
|
||||||
NpcKind::StoneGolem => comp::golem::Body::random().into(),
|
NpcKind::StoneGolem => comp::golem::Body::random().into(),
|
||||||
NpcKind::Reddragon => comp::dragon::Body::random().into(),
|
NpcKind::Reddragon => comp::dragon::Body::random().into(),
|
||||||
@ -255,7 +255,7 @@ impl NpcBody {
|
|||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
parse(
|
parse(
|
||||||
s,
|
s,
|
||||||
NpcKind::Gremlin,
|
NpcKind::Gnome,
|
||||||
&npc_names.biped_small,
|
&npc_names.biped_small,
|
||||||
comp::biped_small::Body::random_with,
|
comp::biped_small::Body::random_with,
|
||||||
)
|
)
|
||||||
|
@ -2,6 +2,7 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ impl Animation for IdleAnimation {
|
|||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
const UPDATE_FN: &'static [u8] = b"biped_small_idle\0";
|
const UPDATE_FN: &'static [u8] = b"biped_small_idle\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "Biped_small_idle")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_small_idle")]
|
||||||
|
|
||||||
fn update_skeleton_inner(
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
@ -24,20 +25,23 @@ impl Animation for IdleAnimation {
|
|||||||
s_a: &SkeletonAttr,
|
s_a: &SkeletonAttr,
|
||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
let slow = (anim_time as f32 * 4.0).sin();
|
||||||
|
|
||||||
next.head.scale = Vec3::one();
|
next.foot_l.scale = Vec3::one() / 13.0;
|
||||||
|
next.foot_r.scale = Vec3::one() / 13.0;
|
||||||
|
|
||||||
next.chest.scale = Vec3::one() / 13.0;
|
next.chest.scale = Vec3::one() / 13.0;
|
||||||
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * -0.1);
|
||||||
|
|
||||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 13.0;
|
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.3) / 13.0;
|
||||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
|
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
|
||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
next.hand_l.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + slow * -0.1);
|
||||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + slow * -0.1);
|
||||||
next.foot_l.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 13.0;
|
||||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 13.0;
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ impl Skeleton for BipedSmallSkeleton {
|
|||||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||||
) -> Vec3<f32> {
|
) -> Vec3<f32> {
|
||||||
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
|
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
|
||||||
let shorts_mat = chest_mat * Mat4::<f32>::from(self.chest);
|
let shorts_mat = chest_mat * Mat4::<f32>::from(self.shorts);
|
||||||
|
|
||||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||||
make_bone(chest_mat * Mat4::<f32>::from(self.head)),
|
make_bone(chest_mat * Mat4::<f32>::from(self.head)),
|
||||||
@ -46,9 +46,9 @@ impl Skeleton for BipedSmallSkeleton {
|
|||||||
make_bone(shorts_mat * Mat4::<f32>::from(self.tail)),
|
make_bone(shorts_mat * Mat4::<f32>::from(self.tail)),
|
||||||
make_bone(chest_mat * Mat4::<f32>::from(self.main)),
|
make_bone(chest_mat * Mat4::<f32>::from(self.main)),
|
||||||
make_bone(chest_mat * Mat4::<f32>::from(self.hand_l)),
|
make_bone(chest_mat * Mat4::<f32>::from(self.hand_l)),
|
||||||
make_bone(chest_mat * Mat4::<f32>::from(self.hand_l)),
|
make_bone(chest_mat * Mat4::<f32>::from(self.hand_r)),
|
||||||
make_bone(base_mat * Mat4::<f32>::from(self.foot_l)),
|
|
||||||
make_bone(base_mat * Mat4::<f32>::from(self.foot_l)),
|
make_bone(base_mat * Mat4::<f32>::from(self.foot_l)),
|
||||||
|
make_bone(base_mat * Mat4::<f32>::from(self.foot_r)),
|
||||||
];
|
];
|
||||||
Vec3::default()
|
Vec3::default()
|
||||||
}
|
}
|
||||||
@ -92,22 +92,22 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
|||||||
use comp::biped_small::Species::*;
|
use comp::biped_small::Species::*;
|
||||||
Self {
|
Self {
|
||||||
head: match (body.species, body.body_type) {
|
head: match (body.species, body.body_type) {
|
||||||
(Gremlin, _) => (0.0, 5.0),
|
(Gnome, _) => (-1.0, 9.0),
|
||||||
},
|
},
|
||||||
chest: match (body.species, body.body_type) {
|
chest: match (body.species, body.body_type) {
|
||||||
(Gremlin, _) => (0.0, 5.0),
|
(Gnome, _) => (0.0, 9.0),
|
||||||
},
|
},
|
||||||
shorts: match (body.species, body.body_type) {
|
shorts: match (body.species, body.body_type) {
|
||||||
(Gremlin, _) => (0.0, 5.0),
|
(Gnome, _) => (0.0, -3.0),
|
||||||
},
|
},
|
||||||
tail: match (body.species, body.body_type) {
|
tail: match (body.species, body.body_type) {
|
||||||
(Gremlin, _) => (-7.5, -0.5),
|
(Gnome, _) => (0.0, 0.0),
|
||||||
},
|
},
|
||||||
hand: match (body.species, body.body_type) {
|
hand: match (body.species, body.body_type) {
|
||||||
(Gremlin, _) => (2.0, 0.5, 1.0),
|
(Gnome, _) => (6.0, 0.5, -1.0),
|
||||||
},
|
},
|
||||||
foot: match (body.species, body.body_type) {
|
foot: match (body.species, body.body_type) {
|
||||||
(Gremlin, _) => (2.0, 0.5, 1.0),
|
(Gnome, _) => (3.0, 0.0, 4.0),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,11 @@ use super::{
|
|||||||
super::{vek::*, Animation},
|
super::{vek::*, Animation},
|
||||||
BipedSmallSkeleton, SkeletonAttr,
|
BipedSmallSkeleton, SkeletonAttr,
|
||||||
};
|
};
|
||||||
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
type RunAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
|
type RunAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>, f32);
|
||||||
|
|
||||||
impl Animation for RunAnimation {
|
impl Animation for RunAnimation {
|
||||||
type Dependency = RunAnimationDependency;
|
type Dependency = RunAnimationDependency;
|
||||||
@ -14,30 +15,157 @@ impl Animation for RunAnimation {
|
|||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
const UPDATE_FN: &'static [u8] = b"biped_small_run\0";
|
const UPDATE_FN: &'static [u8] = b"biped_small_run\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "Biped_small_run")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_small_run")]
|
||||||
|
|
||||||
fn update_skeleton_inner(
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency,
|
(velocity, orientation, last_ori, global_time, avg_vel, acc_vel): Self::Dependency,
|
||||||
anim_time: f64,
|
anim_time: f64,
|
||||||
_rate: &mut f32,
|
rate: &mut f32,
|
||||||
s_a: &SkeletonAttr,
|
s_a: &SkeletonAttr,
|
||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||||
|
*rate = 1.0;
|
||||||
|
let impact = (avg_vel.z).max(-8.0);
|
||||||
|
let speednorm = speed / 9.4;
|
||||||
|
|
||||||
|
let lab = 1.0;
|
||||||
|
|
||||||
|
let footrotl = (((1.0)
|
||||||
|
/ (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin()).powi(2)))
|
||||||
|
.sqrt())
|
||||||
|
* ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin());
|
||||||
|
|
||||||
|
let footrotr = (((1.0)
|
||||||
|
/ (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin()).powi(2)))
|
||||||
|
.sqrt())
|
||||||
|
* ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin());
|
||||||
|
|
||||||
|
let shortalter = (acc_vel * lab as f32 * 1.6 + PI / -2.0).sin();
|
||||||
|
|
||||||
|
let foothoril = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin();
|
||||||
|
let foothorir = (acc_vel * 1.6 * lab as f32 + PI * (0.45)).sin();
|
||||||
|
let footstrafel = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin();
|
||||||
|
let footstrafer = (acc_vel * 1.6 * lab as f32 + PI * (0.95)).sin();
|
||||||
|
|
||||||
|
let footvertl = (acc_vel * 1.6 * lab as f32).sin();
|
||||||
|
let footvertr = (acc_vel * 1.6 * lab as f32 + PI).sin();
|
||||||
|
let footvertsl = (acc_vel * 1.6 * lab as f32).sin();
|
||||||
|
let footvertsr = (acc_vel * 1.6 * lab as f32 + PI * 0.5).sin();
|
||||||
|
|
||||||
|
let shortalt = (acc_vel * lab as f32 * 1.6 + PI / 2.0).sin();
|
||||||
|
|
||||||
|
let short = (((5.0) / (1.5 + 3.5 * ((acc_vel * lab as f32 * 1.6).sin()).powi(2))).sqrt())
|
||||||
|
* ((acc_vel * lab as f32 * 1.6).sin());
|
||||||
|
let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x;
|
||||||
|
|
||||||
|
let side =
|
||||||
|
(velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x) * -1.0;
|
||||||
|
let sideabs = side.abs();
|
||||||
|
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;
|
||||||
|
//println!("speednorm {} ",side);
|
||||||
|
|
||||||
|
let head_look = Vec2::new(
|
||||||
|
((global_time + anim_time) as f32 / 18.0)
|
||||||
|
.floor()
|
||||||
|
.mul(7331.0)
|
||||||
|
.sin()
|
||||||
|
* 0.2,
|
||||||
|
((global_time + anim_time) as f32 / 18.0)
|
||||||
|
.floor()
|
||||||
|
.mul(1337.0)
|
||||||
|
.sin()
|
||||||
|
* 0.1,
|
||||||
|
);
|
||||||
|
next.chest.scale = Vec3::one() / 13.0;
|
||||||
|
next.foot_l.scale = Vec3::one() / 13.0;
|
||||||
|
next.foot_r.scale = Vec3::one() / 13.0;
|
||||||
|
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0, s_a.head.1 + short * 0.1);
|
||||||
|
next.head.orientation =
|
||||||
|
Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.02)
|
||||||
|
* Quaternion::rotation_x(head_look.y + 0.45 * speednorm);
|
||||||
|
|
||||||
|
next.chest.position = Vec3::new(
|
||||||
|
0.0,
|
||||||
|
s_a.chest.0,
|
||||||
|
s_a.chest.1 + 1.0 * speednorm + shortalt * -0.8,
|
||||||
|
) / 13.0;
|
||||||
|
next.chest.orientation = Quaternion::rotation_z(short * 0.06 + tilt * -0.6)
|
||||||
|
* Quaternion::rotation_y(tilt * 1.6)
|
||||||
|
* Quaternion::rotation_x(
|
||||||
|
impact * 0.06 + shortalter * 0.035 + speednorm * -0.4 + (tilt.abs()),
|
||||||
|
);
|
||||||
|
|
||||||
|
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
|
||||||
|
next.shorts.orientation = Quaternion::rotation_x(0.1 * speednorm)
|
||||||
|
* Quaternion::rotation_z(short * 0.25 + tilt * -1.5)
|
||||||
|
* Quaternion::rotation_y(tilt * 0.7);
|
||||||
|
|
||||||
|
next.hand_l.position = Vec3::new(
|
||||||
|
-s_a.hand.0 + foothorir * -1.3 * speednorm,
|
||||||
|
1.0 * speednorm + s_a.hand.1 + foothorir * -3.5 * speednorm,
|
||||||
|
1.5 * speednorm + s_a.hand.2 - foothorir * 2.5 * speednorm,
|
||||||
|
);
|
||||||
|
next.hand_l.orientation =
|
||||||
|
Quaternion::rotation_x(0.4 * speednorm + (footrotr * -1.2) * speednorm)
|
||||||
|
* Quaternion::rotation_y(footrotr * 0.4 * speednorm);
|
||||||
|
|
||||||
|
next.hand_r.position = Vec3::new(
|
||||||
|
s_a.hand.0 + foothoril * 1.3 * speednorm,
|
||||||
|
1.0 * speednorm + s_a.hand.1 + foothoril * -3.5 * speednorm,
|
||||||
|
1.5 * speednorm + s_a.hand.2 - foothoril * 2.5 * speednorm,
|
||||||
|
);
|
||||||
|
next.hand_r.orientation =
|
||||||
|
Quaternion::rotation_x(0.4 * speednorm + (footrotl * -1.2) * speednorm)
|
||||||
|
* Quaternion::rotation_y(footrotl * -0.4 * speednorm);
|
||||||
|
|
||||||
|
//
|
||||||
|
next.foot_l.position = Vec3::new(
|
||||||
|
-s_a.foot.0 + footstrafel * sideabs * 3.0 + tilt * -2.0,
|
||||||
|
s_a.foot.1
|
||||||
|
+ (1.0 - sideabs) * (-1.0 * speednorm + foothoril * -7.5 * speednorm)
|
||||||
|
+ (direction * 5.0).max(0.0),
|
||||||
|
s_a.foot.2
|
||||||
|
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertl * -2.1 * speednorm).max(-1.0)))
|
||||||
|
+ side * ((footvertsl * 1.5).max(-1.0)),
|
||||||
|
) / 13.0;
|
||||||
|
next.foot_l.orientation = Quaternion::rotation_x(
|
||||||
|
(1.0 - sideabs) * (-0.2 + foothoril * -1.3 * speednorm) + sideabs * -0.5,
|
||||||
|
) * Quaternion::rotation_y(
|
||||||
|
tilt * 2.0 + side * 0.3 + side * (foothoril * 0.3),
|
||||||
|
) * Quaternion::rotation_z(side * 0.2);
|
||||||
|
|
||||||
|
next.foot_r.position = Vec3::new(
|
||||||
|
s_a.foot.0 + footstrafer * sideabs * 3.0 + tilt * -2.0,
|
||||||
|
s_a.foot.1
|
||||||
|
+ (1.0 - sideabs) * (-1.0 * speednorm + foothorir * -7.5 * speednorm)
|
||||||
|
+ (direction * 5.0).max(0.0),
|
||||||
|
s_a.foot.2
|
||||||
|
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertr * -2.1 * speednorm).max(-1.0)))
|
||||||
|
+ side * ((footvertsr * -1.5).max(-1.0)),
|
||||||
|
) / 13.0;
|
||||||
|
next.foot_r.orientation = Quaternion::rotation_x(
|
||||||
|
(1.0 - sideabs) * (-0.2 + foothorir * -1.3 * speednorm) + sideabs * -0.5,
|
||||||
|
) * Quaternion::rotation_y(
|
||||||
|
tilt * 2.0 + side * 0.3 + side * (foothorir * 0.3),
|
||||||
|
) * Quaternion::rotation_z(side * 0.2);
|
||||||
|
|
||||||
next.head.scale = Vec3::one();
|
next.head.scale = Vec3::one();
|
||||||
|
|
||||||
next.chest.scale = Vec3::one() / 13.0;
|
|
||||||
|
|
||||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 13.0;
|
|
||||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
|
|
||||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
next.hand_l.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
|
||||||
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
|
|
||||||
next.foot_l.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
|
||||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ impl Animation for RunAnimation {
|
|||||||
+ side * ((footvertsl * 1.5).max(-1.0)),
|
+ side * ((footvertsl * 1.5).max(-1.0)),
|
||||||
);
|
);
|
||||||
next.foot_l.orientation = Quaternion::rotation_x(
|
next.foot_l.orientation = Quaternion::rotation_x(
|
||||||
(1.0 - sideabs) * (-0.2 + foothoril * -1.3 * speednorm) + sideabs * -0.5,
|
(1.0 - sideabs) * (-0.2 + foothoril * -0.9 * speednorm) + sideabs * -0.5,
|
||||||
) * Quaternion::rotation_y(
|
) * Quaternion::rotation_y(
|
||||||
tilt * 2.0 + side * 0.3 + side * (foothoril * 0.3),
|
tilt * 2.0 + side * 0.3 + side * (foothoril * 0.3),
|
||||||
) * Quaternion::rotation_z(side * 0.2);
|
) * Quaternion::rotation_z(side * 0.2);
|
||||||
@ -190,7 +190,7 @@ impl Animation for RunAnimation {
|
|||||||
+ side * ((footvertsr * -1.5).max(-1.0)),
|
+ side * ((footvertsr * -1.5).max(-1.0)),
|
||||||
);
|
);
|
||||||
next.foot_r.orientation = Quaternion::rotation_x(
|
next.foot_r.orientation = Quaternion::rotation_x(
|
||||||
(1.0 - sideabs) * (-0.2 + foothorir * -1.3 * speednorm) + sideabs * -0.5,
|
(1.0 - sideabs) * (-0.2 + foothorir * -0.9 * speednorm) + sideabs * -0.5,
|
||||||
) * Quaternion::rotation_y(
|
) * Quaternion::rotation_y(
|
||||||
tilt * 2.0 + side * 0.3 + side * (foothorir * 0.3),
|
tilt * 2.0 + side * 0.3 + side * (foothorir * 0.3),
|
||||||
) * Quaternion::rotation_z(side * 0.2);
|
) * Quaternion::rotation_z(side * 0.2);
|
||||||
|
@ -2582,7 +2582,14 @@ impl FigureMgr {
|
|||||||
// Run
|
// Run
|
||||||
(true, true, _) => anim::biped_small::RunAnimation::update_skeleton(
|
(true, true, _) => anim::biped_small::RunAnimation::update_skeleton(
|
||||||
&BipedSmallSkeleton::default(),
|
&BipedSmallSkeleton::default(),
|
||||||
(vel.0, ori, state.last_ori, time, state.avg_vel),
|
(
|
||||||
|
vel.0,
|
||||||
|
ori,
|
||||||
|
state.last_ori,
|
||||||
|
time,
|
||||||
|
state.avg_vel,
|
||||||
|
state.acc_vel,
|
||||||
|
),
|
||||||
state.state_time,
|
state.state_time,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
@ -2590,7 +2597,14 @@ impl FigureMgr {
|
|||||||
// Jump
|
// Jump
|
||||||
(false, _, false) => anim::biped_small::RunAnimation::update_skeleton(
|
(false, _, false) => anim::biped_small::RunAnimation::update_skeleton(
|
||||||
&BipedSmallSkeleton::default(),
|
&BipedSmallSkeleton::default(),
|
||||||
(vel.0, ori, state.last_ori, time, state.avg_vel),
|
(
|
||||||
|
vel.0,
|
||||||
|
ori,
|
||||||
|
state.last_ori,
|
||||||
|
time,
|
||||||
|
state.avg_vel,
|
||||||
|
state.acc_vel,
|
||||||
|
),
|
||||||
state.state_time,
|
state.state_time,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
@ -2598,14 +2612,28 @@ impl FigureMgr {
|
|||||||
// Swim
|
// Swim
|
||||||
(false, _, true) => anim::biped_small::RunAnimation::update_skeleton(
|
(false, _, true) => anim::biped_small::RunAnimation::update_skeleton(
|
||||||
&BipedSmallSkeleton::default(),
|
&BipedSmallSkeleton::default(),
|
||||||
(vel.0, ori, state.last_ori, time, state.avg_vel),
|
(
|
||||||
|
vel.0,
|
||||||
|
ori,
|
||||||
|
state.last_ori,
|
||||||
|
time,
|
||||||
|
state.avg_vel,
|
||||||
|
state.acc_vel,
|
||||||
|
),
|
||||||
state.state_time,
|
state.state_time,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
_ => anim::biped_small::RunAnimation::update_skeleton(
|
_ => anim::biped_small::RunAnimation::update_skeleton(
|
||||||
&BipedSmallSkeleton::default(),
|
&BipedSmallSkeleton::default(),
|
||||||
(vel.0, ori, state.last_ori, time, state.avg_vel),
|
(
|
||||||
|
vel.0,
|
||||||
|
ori,
|
||||||
|
state.last_ori,
|
||||||
|
time,
|
||||||
|
state.avg_vel,
|
||||||
|
state.acc_vel,
|
||||||
|
),
|
||||||
state.state_time,
|
state.state_time,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
|
Loading…
Reference in New Issue
Block a user