dragon and general animation cleanup

This commit is contained in:
jshipsey 2020-05-09 18:01:49 -04:00
parent 5b77c74497
commit 62bd79dba7
24 changed files with 231 additions and 347 deletions

View File

@ -25,11 +25,11 @@
lateral: ("npc.ogre.male.leg_r"),
),
foot_l: (
offset: (-3.0, -5.0, -3.0),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.male.foot_l"),
),
foot_r: (
offset: (-3.0, -5.0, -3.0),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.male.foot_r"),
)
),
@ -59,11 +59,11 @@
lateral: ("npc.ogre.female.leg_r"),
),
foot_l: (
offset: (-3.0, -5.0, -3.0),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.female.foot_l"),
),
foot_r: (
offset: (-3.0, -5.0, -3.0),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.female.foot_r"),
)
),

View File

@ -21,11 +21,11 @@
center: ("npc.reddragon.male.chest_rear"),
),
tail_front: (
offset: (-2.5, -6.0, -3.5),
offset: (-2.5, -12.0, -3.5),
center: ("npc.reddragon.male.tail_front"),
),
tail_rear: (
offset: (-3.5, -8.0, -3.0),
offset: (-3.5, -16.0, -3.0),
center: ("npc.reddragon.male.tail_rear"),
)
),
@ -51,11 +51,11 @@
center: ("npc.reddragon.female.chest_rear"),
),
tail_front: (
offset: (-2.5, -6.0, -3.5),
offset: (-2.5, -12.0, -3.5),
center: ("npc.reddragon.female.tail_front"),
),
tail_rear: (
offset: (-3.5, -8.0, -3.0),
offset: (-3.5, -16.0, -3.0),
center: ("npc.reddragon.female.tail_rear"),
)
),

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -93,7 +93,7 @@ pub fn kind_to_body(kind: NpcKind) -> Body {
NpcKind::Ogre => comp::biped_large::Body::random().into(),
NpcKind::Rat => comp::critter::Body::random().into(),
NpcKind::StoneGolem => comp::golem::Body::random().into(),
NpcKind::Reddragon => comp::critter::Body::random().into(),
NpcKind::Reddragon => comp::dragon::Body::random().into(),
}
}

View File

@ -1,114 +1,108 @@
pub mod fly;
pub mod idle;
pub mod jump;
pub mod run;
// Reexports
pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
use super::{Bone, Skeleton};
use crate::render::FigureBoneData;
use common::comp::{self};
#[derive(Clone, Default)]
pub struct DragonSkeleton {
head_upper: Bone,
head_lower: Bone,
jaw: Bone,
chest_front: Bone,
chest_rear: Bone,
tail_front: Bone,
tail_rear: Bone,
wing_in_l: Bone,
wing_in_r: Bone,
wing_out_l: Bone,
wing_out_r: Bone,
foot_fl: Bone,
foot_fr: Bone,
foot_bl: Bone,
foot_br: Bone,
#[derive(Clone)]
pub struct BipedLargeSkeleton {
head: Bone,
upper_torso: Bone,
lower_torso: Bone,
shoulder_l: Bone,
shoulder_r: Bone,
hand_l: Bone,
hand_r: Bone,
leg_l: Bone,
leg_r: Bone,
foot_l: Bone,
foot_r: Bone,
torso: Bone,
}
impl DragonSkeleton {
pub fn new() -> Self { Self::default() }
impl BipedLargeSkeleton {
pub fn new() -> Self {
Self {
head: Bone::default(),
upper_torso: Bone::default(),
lower_torso: Bone::default(),
shoulder_l: Bone::default(),
shoulder_r: Bone::default(),
hand_l: Bone::default(),
hand_r: Bone::default(),
leg_l: Bone::default(),
leg_r: Bone::default(),
foot_l: Bone::default(),
foot_r: Bone::default(),
torso: Bone::default(),
}
}
}
impl Skeleton for DragonSkeleton {
impl Skeleton for BipedLargeSkeleton {
type Attr = SkeletonAttr;
fn bone_count(&self) -> usize { 15 }
fn bone_count(&self) -> usize { 11 }
fn compute_matrices(&self) -> [FigureBoneData; 16] {
let head_upper_mat = self.head_upper.compute_base_matrix();
let head_lower_mat = self.head_lower.compute_base_matrix();
let chest_front_mat = self.chest_front.compute_base_matrix();
let chest_rear_mat = self.chest_rear.compute_base_matrix();
let wing_in_l_mat = self.wing_in_l.compute_base_matrix();
let wing_in_r_mat = self.wing_in_r.compute_base_matrix();
let tail_front_mat = self.tail_front.compute_base_matrix();
let upper_torso_mat = self.upper_torso.compute_base_matrix();
let shoulder_l_mat = self.shoulder_l.compute_base_matrix();
let shoulder_r_mat = self.shoulder_r.compute_base_matrix();
let leg_l_mat = self.leg_l.compute_base_matrix();
let leg_r_mat = self.leg_r.compute_base_matrix();
let torso_mat = self.torso.compute_base_matrix();
[
FigureBoneData::new(chest_front_mat * head_lower_mat * head_upper_mat),
FigureBoneData::new(chest_front_mat * head_lower_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * self.head.compute_base_matrix()),
FigureBoneData::new(torso_mat * upper_torso_mat),
FigureBoneData::new(
chest_front_mat * head_lower_mat * head_upper_mat * self.jaw.compute_base_matrix(),
torso_mat * upper_torso_mat * self.lower_torso.compute_base_matrix(),
),
FigureBoneData::new(chest_front_mat),
FigureBoneData::new(chest_front_mat * self.chest_rear.compute_base_matrix()),
FigureBoneData::new(chest_front_mat * chest_rear_mat * tail_front_mat),
FigureBoneData::new(
chest_front_mat
* chest_rear_mat
* tail_front_mat
* self.tail_rear.compute_base_matrix(),
),
FigureBoneData::new(chest_front_mat * self.wing_in_l.compute_base_matrix()),
FigureBoneData::new(chest_front_mat * self.wing_in_r.compute_base_matrix()),
FigureBoneData::new(
chest_front_mat * wing_in_l_mat * self.wing_out_l.compute_base_matrix(),
),
FigureBoneData::new(
chest_front_mat * wing_in_r_mat * self.wing_out_r.compute_base_matrix(),
),
FigureBoneData::new(self.foot_fl.compute_base_matrix()),
FigureBoneData::new(self.foot_fr.compute_base_matrix()),
FigureBoneData::new(self.foot_bl.compute_base_matrix()),
FigureBoneData::new(self.foot_br.compute_base_matrix()),
FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_l_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_r_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * self.hand_l.compute_base_matrix()),
FigureBoneData::new(torso_mat * upper_torso_mat * self.hand_r.compute_base_matrix()),
FigureBoneData::new(torso_mat * upper_torso_mat * leg_l_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * leg_r_mat),
FigureBoneData::new(self.foot_l.compute_base_matrix()),
FigureBoneData::new(self.foot_r.compute_base_matrix()),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
]
}
fn interpolate(&mut self, target: &Self, dt: f32) {
self.head_upper.interpolate(&target.head_upper, dt);
self.head_lower.interpolate(&target.head_lower, dt);
self.jaw.interpolate(&target.jaw, dt);
self.chest_front.interpolate(&target.chest_front, dt);
self.chest_rear.interpolate(&target.chest_rear, dt);
self.tail_front.interpolate(&target.tail_front, dt);
self.tail_rear.interpolate(&target.tail_rear, dt);
self.wing_in_l.interpolate(&target.wing_in_l, dt);
self.wing_in_r.interpolate(&target.wing_in_r, dt);
self.wing_out_l.interpolate(&target.wing_out_l, dt);
self.wing_out_r.interpolate(&target.wing_out_r, dt);
self.foot_fl.interpolate(&target.foot_fl, dt);
self.foot_fr.interpolate(&target.foot_fr, dt);
self.foot_bl.interpolate(&target.foot_bl, dt);
self.foot_br.interpolate(&target.foot_br, dt);
self.head.interpolate(&target.head, dt);
self.upper_torso.interpolate(&target.upper_torso, dt);
self.lower_torso.interpolate(&target.lower_torso, dt);
self.shoulder_l.interpolate(&target.shoulder_l, dt);
self.shoulder_r.interpolate(&target.shoulder_r, dt);
self.hand_l.interpolate(&target.hand_l, dt);
self.hand_r.interpolate(&target.hand_r, dt);
self.leg_l.interpolate(&target.leg_l, dt);
self.leg_r.interpolate(&target.leg_r, dt);
self.foot_l.interpolate(&target.foot_l, dt);
self.foot_r.interpolate(&target.foot_r, dt);
self.torso.interpolate(&target.torso, dt);
}
}
pub struct SkeletonAttr {
head_upper: (f32, f32),
head_lower: (f32, f32),
jaw: (f32, f32),
chest_front: (f32, f32),
chest_rear: (f32, f32),
tail_front: (f32, f32),
tail_rear: (f32, f32),
wing_in: (f32, f32, f32),
wing_out: (f32, f32, f32),
feet_f: (f32, f32, f32),
feet_b: (f32, f32, f32),
height: f32,
head: (f32, f32),
upper_torso: (f32, f32),
lower_torso: (f32, f32),
shoulder: (f32, f32, f32),
hand: (f32, f32, f32),
leg: (f32, f32, f32),
foot: (f32, f32, f32),
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -116,7 +110,7 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
fn try_from(body: &'a comp::Body) -> Result<Self, Self::Error> {
match body {
comp::Body::Dragon(body) => Ok(SkeletonAttr::from(body)),
comp::Body::BipedLarge(body) => Ok(SkeletonAttr::from(body)),
_ => Err(()),
}
}
@ -125,61 +119,41 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
impl Default for SkeletonAttr {
fn default() -> Self {
Self {
head_upper: (0.0, 0.0),
head_lower: (0.0, 0.0),
jaw: (0.0, 0.0),
chest_front: (0.0, 0.0),
chest_rear: (0.0, 0.0),
tail_front: (0.0, 0.0),
tail_rear: (0.0, 0.0),
wing_in: (0.0, 0.0, 0.0),
wing_out: (0.0, 0.0, 0.0),
feet_f: (0.0, 0.0, 0.0),
feet_b: (0.0, 0.0, 0.0),
height: (0.0),
head: (0.0, 0.0),
upper_torso: (0.0, 0.0),
lower_torso: (0.0, 0.0),
shoulder: (0.0, 0.0, 0.0),
hand: (0.0, 0.0, 0.0),
leg: (0.0, 0.0, 0.0),
foot: (0.0, 0.0, 0.0),
}
}
}
impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
fn from(body: &'a comp::dragon::Body) -> Self {
use comp::dragon::Species::*;
impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
fn from(body: &'a comp::biped_large::Body) -> Self {
use comp::biped_large::Species::*;
Self {
head_upper: match (body.species, body.body_type) {
(Reddragon, _) => (2.5, 4.5),
head: match (body.species, body.body_type) {
(Ogre, _) => (3.0, 6.0),
},
head_lower: match (body.species, body.body_type) {
(Reddragon, _) => (7.5, 3.5),
upper_torso: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 19.0),
},
jaw: match (body.species, body.body_type) {
(Reddragon, _) => (7.0, -5.0),
lower_torso: match (body.species, body.body_type) {
(Ogre, _) => (1.0, -9.5),
},
chest_front: match (body.species, body.body_type) {
(Reddragon, _) => (0.0, 14.0),
shoulder: match (body.species, body.body_type) {
(Ogre, _) => (6.1, 0.5, 2.5),
},
chest_rear: match (body.species, body.body_type) {
(Reddragon, _) => (-12.5, 0.0),
hand: match (body.species, body.body_type) {
(Ogre, _) => (10.5, -1.0, -0.5),
},
tail_front: match (body.species, body.body_type) {
(Reddragon, _) => (-6.5, 1.5),
leg: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 0.0, -6.0),
},
tail_rear: match (body.species, body.body_type) {
(Reddragon, _) => (-11.5, -1.0),
},
wing_in: match (body.species, body.body_type) {
(Reddragon, _) => (2.5, -16.5, 0.0),
},
wing_out: match (body.species, body.body_type) {
(Reddragon, _) => (23.0, 0.5, 4.0),
},
feet_f: match (body.species, body.body_type) {
(Reddragon, _) => (6.0, 0.0, 1.5),
},
feet_b: match (body.species, body.body_type) {
(Reddragon, _) => (6.0, -15.0, 3.0),
},
height: match (body.species, body.body_type) {
(Reddragon, _) => (1.0),
foot: match (body.species, body.body_type) {
(Ogre, _) => (4.0, 0.5, 2.5),
},
}
}

View File

@ -41,7 +41,7 @@ impl Animation for RunAnimation {
* ((anim_time as f32 * lab as f32 + PI * 0.4).sin());
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.ori = Quaternion::rotation_z(belt * -0.3) * Quaternion::rotation_x(0.3);
next.head.ori = Quaternion::rotation_z(belt * -0.3) * Quaternion::rotation_x(0.1);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.offset = Vec3::new(
@ -132,7 +132,7 @@ impl Animation for RunAnimation {
next.foot_r.scale = Vec3::one() / 8.0 * 0.98;
next.torso.offset = Vec3::new(0.0, 0.0, beltsnap * 0.25);
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.2);
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.13);
next.torso.scale = Vec3::one();
next
}

View File

@ -68,11 +68,9 @@ impl Animation for AlphaAnimation {
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori = next.chest.ori * -0.3;
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = next.chest.ori * -0.45;
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-0.25, -5.0, 1.0);
next.l_hand.ori = Quaternion::rotation_x(1.27);
@ -84,7 +82,6 @@ impl Animation for AlphaAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-10.0 + push * 5.0, 6.0 + push * 5.0, 2.0);
next.control.ori = Quaternion::rotation_x(-1.4 + slow * 0.4)
@ -130,11 +127,9 @@ impl Animation for AlphaAnimation {
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = next.chest.ori * -0.2;
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = next.chest.ori * -0.15;
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-4.0, 3.0, 2.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
@ -150,7 +145,6 @@ impl Animation for AlphaAnimation {
next.main.ori = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(-0.8);
next.main.scale = Vec3::one();
next.lantern.ori = Quaternion::rotation_x(slowax * -0.7 + 0.4)
* Quaternion::rotation_y(slowax * 0.4);
@ -174,10 +168,7 @@ impl Animation for AlphaAnimation {
next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.main.ori = Quaternion::rotation_x(-0.3);
next.head.offset =
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.head.ori = Quaternion::rotation_z(slower * 0.05)
@ -189,23 +180,18 @@ impl Animation for AlphaAnimation {
next.chest.ori = Quaternion::rotation_z(slower * 0.2)
* Quaternion::rotation_x(0.0 + slower * 0.2)
* Quaternion::rotation_y(slower * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = next.chest.ori * -0.2;
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = next.chest.ori * -0.15;
next.shorts.scale = Vec3::one();
next.lantern.ori = Quaternion::rotation_x(slower * -0.7 + 0.4)
* Quaternion::rotation_y(slower * 0.4);
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
if velocity > 0.5 {
@ -232,9 +218,7 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_z((slower * 0.5).max(0.0));
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
}
@ -245,9 +229,7 @@ impl Animation for AlphaAnimation {
next.control.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
},
Some(ToolKind::Staff(_)) => {
@ -272,7 +254,6 @@ impl Animation for AlphaAnimation {
next.shorts.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.05;
@ -281,7 +262,6 @@ impl Animation for AlphaAnimation {
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -4.0);
next.main.ori = Quaternion::rotation_x(-0.3);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0 - slow * 1.0, 3.0 - slow * 5.0, 0.0);
next.control.ori = Quaternion::rotation_x(-1.2)
@ -306,19 +286,16 @@ impl Animation for AlphaAnimation {
next.chest.ori = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
@ -337,7 +314,6 @@ impl Animation for AlphaAnimation {
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
},
@ -358,15 +334,15 @@ impl Animation for AlphaAnimation {
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
* Quaternion::rotation_x(accel_med * -0.8)
* Quaternion::rotation_y(accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
* Quaternion::rotation_x(accel_med * -0.8)
* Quaternion::rotation_y(accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
@ -386,17 +362,11 @@ impl Animation for AlphaAnimation {
skeleton_attr.lantern.2,
);
next.lantern.scale = Vec3::one() * 0.65;
next.l_shoulder.scale = Vec3::one() * 1.1;
next.r_shoulder.scale = Vec3::one() * 1.1;
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.l_control.scale = Vec3::one();
next.r_control.scale = Vec3::one();
next
}

View File

@ -52,19 +52,16 @@ impl Animation for BetaAnimation {
next.chest.ori = Quaternion::rotation_z(slow * 0.2)
* Quaternion::rotation_x(slow * 0.2)
* Quaternion::rotation_y(slow * -0.1);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.04);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.05);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(1.27);
@ -74,7 +71,6 @@ impl Animation for BetaAnimation {
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
next.main.ori = Quaternion::rotation_x(-0.3);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0 + slow * 1.5, 1.5 + slow * 1.0, 0.0);
next.control.ori = Quaternion::rotation_x(-1.4)
@ -84,12 +80,10 @@ impl Animation for BetaAnimation {
next.l_foot.offset = Vec3::new(-3.4, footquick * -9.5, 8.0);
next.l_foot.ori = Quaternion::rotation_x(footquick * 0.3)
* Quaternion::rotation_y(footquick * -0.6);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, footquick * 9.5, 8.0);
next.r_foot.ori = Quaternion::rotation_x(footquick * -0.3)
* Quaternion::rotation_y(footquick * 0.2);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
},

View File

@ -58,18 +58,13 @@ impl Animation for ChargeAnimation {
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.ori = Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.chest.scale = Vec3::one();
next.chest.ori = Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02);
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori = Quaternion::rotation_z(stop * -0.5);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_z(stop * -0.7);
next.shorts.scale = Vec3::one();
match active_tool_kind {
//TODO: Inventory
@ -86,7 +81,6 @@ impl Animation for ChargeAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(
-7.0 + quick * 3.5 * (1.0 / (stopa + 0.1)),
@ -112,7 +106,6 @@ impl Animation for ChargeAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-9.0 + stop * 13.0, 6.0 + stop * 4.0, 8.0);
next.control.ori = Quaternion::rotation_x(0.0)
@ -127,19 +120,15 @@ impl Animation for ChargeAnimation {
next.l_foot.ori = Quaternion::rotation_x(foote * -0.1)
* Quaternion::rotation_z(0.4)
* Quaternion::rotation_y(0.15);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4 + foot * 1.5, foote * -1.5, 8.0);
next.r_foot.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_z(0.4)
* Quaternion::rotation_y(0.0);
next.r_foot.scale = Vec3::one();
next.torso.offset =
Vec3::new(0.0 + foot * 0.03, foote * 0.05, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
} else {
next.l_foot.offset = Vec3::new(-3.4, -2.5 + stop * -1.3, 8.0);
@ -153,9 +142,7 @@ impl Animation for ChargeAnimation {
Quaternion::rotation_x(stop * 0.1) * Quaternion::rotation_z(stop * 0.1);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
}
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);

View File

@ -41,10 +41,10 @@ impl Animation for RollAnimation {
next.head.offset = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + wave_dub * -8.0,
-2.0 + skeleton_attr.head.0 + 3.0,
skeleton_attr.head.1 - 2.0,
);
next.head.ori = Quaternion::rotation_x(wave_dub * 0.4);
next.head.ori = Quaternion::rotation_x(wave_dub * -0.8);
next.head.scale = Vec3::one();
next.chest.offset = Vec3::new(
@ -57,19 +57,17 @@ impl Animation for RollAnimation {
next.belt.offset = Vec3::new(
0.0,
skeleton_attr.belt.0,
skeleton_attr.belt.0 + wave_dub * -3.0,
skeleton_attr.belt.0 + 2.0,
skeleton_attr.belt.1 + 2.0,
);
next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4);
next.belt.scale = Vec3::one();
next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.8);
next.shorts.offset = Vec3::new(
0.0,
skeleton_attr.shorts.0,
skeleton_attr.shorts.0 + wave_dub * -2.0,
skeleton_attr.shorts.0 + 2.0,
skeleton_attr.shorts.1 + 3.0,
);
next.shorts.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4);
next.shorts.scale = Vec3::one();
next.shorts.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.8);
next.l_hand.offset = Vec3::new(
-skeleton_attr.chest.0 + wave * -0.5,
@ -88,23 +86,20 @@ impl Animation for RollAnimation {
);
next.r_hand.ori =
Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(wave * 0.3);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + wave_dub * -1.2 + wave_slow * 4.0,
skeleton_attr.foot.2 + wave_dub * -1.2,
);
next.l_foot.ori = Quaternion::rotation_x(wave * 0.6);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + wave_dub * -1.0 + wave_slow * 4.0,
skeleton_attr.foot.2 + wave_dub * -1.0,
);
next.r_foot.ori = Quaternion::rotation_x(wave * -0.4);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(
-skeleton_attr.shoulder.0,
@ -141,7 +136,7 @@ impl Animation for RollAnimation {
next.lantern.scale = Vec3::one() * 0.65;
next.torso.offset =
Vec3::new(0.0, 0.0, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
Vec3::new(0.0, 0.0, 0.0 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(tilt);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;

View File

@ -26,11 +26,6 @@ impl Animation for RunAnimation {
let lower = if speed > 5.0 { 0.0 } else { 1.0 };
let snapfoot = if speed > 5.0 { 1.1 } else { 2.0 };
let lab = 1.0;
let long = (((5.0)
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 8.0 * walk).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 8.0 * walk).sin());
let short = (((5.0)
/ (1.5
+ 3.5 * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powf(2.0 as f32)))
@ -94,7 +89,7 @@ impl Animation for RunAnimation {
-3.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.1 + short * 0.1,
);
next.head.ori = Quaternion::rotation_z(head_look.x + long * -0.1 - short * 0.1)
next.head.ori = Quaternion::rotation_z(head_look.x - short * 0.1)
* Quaternion::rotation_x(head_look.y + 0.35);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;

View File

@ -46,11 +46,9 @@ impl Animation for ShootAnimation {
next.chest.ori = Quaternion::rotation_z(0.4 + exp * 1.0)
* Quaternion::rotation_x(0.0 + exp * 0.2)
* Quaternion::rotation_y(exp * -0.08);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + exp * 1.0, skeleton_attr.belt.1);
next.belt.ori = next.chest.ori * -0.1;
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(
0.0,
@ -58,7 +56,6 @@ impl Animation for ShootAnimation {
skeleton_attr.shorts.1,
);
next.shorts.ori = next.chest.ori * -0.08;
next.shorts.scale = Vec3::one();
match active_tool_kind {
//TODO: Inventory
@ -75,7 +72,6 @@ impl Animation for ShootAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0 - exp * 5.0);
next.control.ori = Quaternion::rotation_x(exp * 1.3)
@ -98,7 +94,6 @@ impl Animation for ShootAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-9.0, 6.0, 8.0);
next.control.ori = Quaternion::rotation_x(exp * 0.4)
@ -123,23 +118,17 @@ impl Animation for ShootAnimation {
* Quaternion::rotation_y(0.0);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(-0.15)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_x(-0.15);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
} else {
next.l_foot.offset = Vec3::new(-3.4, -2.5, 8.0 + exp * 2.5);
next.l_foot.ori =
Quaternion::rotation_x(exp * -0.2 - 0.2) * Quaternion::rotation_z(exp * 1.0);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 3.5 - exp * 2.0, 8.0);
next.r_foot.ori = Quaternion::rotation_x(exp * 0.1) * Quaternion::rotation_z(exp * 0.5);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
}
next.back.offset = Vec3::new(0.0, -2.8, 7.25);

View File

@ -89,7 +89,6 @@ impl Animation for SitAnimation {
skeleton_attr.foot.2,
);
next.l_foot.ori = Quaternion::rotation_x(slow * 0.1 + stop * 1.2 + slow * 0.1);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(
skeleton_attr.foot.0,
@ -97,7 +96,6 @@ impl Animation for SitAnimation {
skeleton_attr.foot.2,
);
next.r_foot.ori = Quaternion::rotation_x(slowa * 0.1 + stop * 1.2 + slowa * 0.1);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(
-skeleton_attr.shoulder.0,

View File

@ -59,11 +59,9 @@ impl Animation for SwimAnimation {
skeleton_attr.chest.1 + short * 1.3,
);
next.chest.ori = Quaternion::rotation_z(short * 0.4);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori = Quaternion::rotation_z(short * 0.30);
next.belt.scale = Vec3::one();
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.ori = Quaternion::rotation_z(0.0);
@ -71,7 +69,6 @@ impl Animation for SwimAnimation {
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_z(short * 0.5);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-skeleton_attr.hand.0,
@ -79,7 +76,6 @@ impl Animation for SwimAnimation {
skeleton_attr.hand.2 + foot * -3.0,
);
next.l_hand.ori = Quaternion::rotation_x(0.8 + foot * -0.6) * Quaternion::rotation_y(0.2);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(
skeleton_attr.hand.0,
@ -87,7 +83,6 @@ impl Animation for SwimAnimation {
skeleton_attr.hand.2 + foot * 3.0,
);
next.r_hand.ori = Quaternion::rotation_x(0.8 + foot * 0.6) * Quaternion::rotation_y(-0.2);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(
-skeleton_attr.foot.0,
@ -95,7 +90,6 @@ impl Animation for SwimAnimation {
-5.0 + skeleton_attr.foot.2 + foot * 6.5,
);
next.l_foot.ori = Quaternion::rotation_x(-1.40 + foot * 0.6);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(
skeleton_attr.foot.0,
@ -103,7 +97,6 @@ impl Animation for SwimAnimation {
-5.0 + skeleton_attr.foot.2 + foot * -6.5,
);
next.r_foot.ori = Quaternion::rotation_x(-1.40 + foot * -0.6);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(
-skeleton_attr.shoulder.0,
@ -140,7 +133,7 @@ impl Animation for SwimAnimation {
next.torso.offset = Vec3::new(0.0, -0.3 + shortalt * -0.065, 0.4) * skeleton_attr.scaler;
next.torso.ori =
Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05) * Quaternion::rotation_y(0.0);
Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one();

View File

@ -76,15 +76,12 @@ impl Animation for WieldAnimation {
next.l_foot.offset = Vec3::new(-3.4, -2.5, 9.0);
next.l_foot.ori = Quaternion::rotation_x(ultra_slow_cos * 0.035 - 0.2);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 3.5, 9.0);
next.r_foot.ori = Quaternion::rotation_x(ultra_slow * 0.035);
next.r_foot.scale = Vec3::one();
next.chest.ori =
Quaternion::rotation_y(ultra_slow_cos * 0.04) * Quaternion::rotation_z(0.15);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori =
@ -96,22 +93,20 @@ impl Animation for WieldAnimation {
next.back.scale = Vec3::one() * 1.02;
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_z(0.3);
next.shorts.scale = Vec3::one();
}
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Sword(_)) => {
next.l_hand.offset = Vec3::new(-0.25, -5.0, -5.0);
next.l_hand.offset = Vec3::new(-0.25, -5.0, -2.0);
next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.offset = Vec3::new(1.25, -5.5, -8.0);
next.r_hand.offset = Vec3::new(1.25, -5.5, -5.0);
next.r_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 0.0, -6.0);
next.main.offset = Vec3::new(0.0, 0.0, -3.0);
next.main.ori = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.15)
@ -134,7 +129,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(-0.8);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(ultra_slow_cos * 0.1 + 0.2)
@ -153,7 +147,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.15)
@ -174,7 +167,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-14.0, 1.8, 3.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2)
@ -210,7 +202,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2)
@ -252,7 +243,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(3.14)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.1)

View File

@ -21,7 +21,6 @@ impl Animation for FlyAnimation {
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
//let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wingl = (anim_time as f32 * 2.0 + PI).sin();
@ -37,19 +36,19 @@ impl Animation for FlyAnimation {
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + wave_ultra_slow * 0.20,
) * 1.05;
);
next.head_upper.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
next.head_upper.scale = Vec3::one() * 1.05;
next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + wave_ultra_slow * 0.20,
) * 1.05;
);
next.head_lower.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
next.head_lower.scale = Vec3::one() * 1.05;
next.head_lower.scale = Vec3::one();
next.jaw.offset = Vec3::new(
0.0,
@ -65,7 +64,7 @@ impl Animation for FlyAnimation {
skeleton_attr.tail_front.1 + centeroffset * 0.6,
);
next.tail_front.ori = Quaternion::rotation_x(center * 0.03);
next.tail_front.scale = Vec3::one();
next.tail_front.scale = Vec3::one()*0.98;
next.tail_rear.offset = Vec3::new(
0.0,
@ -73,55 +72,55 @@ impl Animation for FlyAnimation {
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
);
next.tail_rear.ori = Quaternion::rotation_x(center * 0.03);
next.tail_rear.scale = Vec3::one();
next.tail_rear.scale = Vec3::one()*0.98;
next.chest_front.offset = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1,
) * 1.05;
);
next.chest_front.ori = Quaternion::rotation_y(center * 0.05);
next.chest_front.scale = Vec3::one() * 1.05;
next.chest_front.scale = Vec3::one();
next.chest_rear.offset = Vec3::new(
0.0,
skeleton_attr.chest_rear.0,
skeleton_attr.chest_rear.1,
) * 1.05;
);
next.chest_rear.ori = Quaternion::rotation_y(center * 0.05);
next.chest_rear.scale = Vec3::one() * 1.05;
next.chest_rear.scale = Vec3::one();
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
) * 1.05;
);
next.foot_fl.ori = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_fl.scale = Vec3::one() * 1.05;
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
) * 1.05;
);
next.foot_fr.ori = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_fr.scale = Vec3::one() * 1.05;
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
) * 1.05;
);
next.foot_bl.ori = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_bl.scale = Vec3::one() * 1.05;
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
) * 1.05;
);
next.foot_br.ori = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_br.scale = Vec3::one() * 1.05;
next.foot_br.scale = Vec3::one();
next.wing_in_l.offset = Vec3::new(
-skeleton_attr.wing_in.0,
@ -129,7 +128,7 @@ impl Animation for FlyAnimation {
skeleton_attr.wing_in.2,
);
next.wing_in_l.ori = Quaternion::rotation_y(0.4 + wingl * 0.6);
next.wing_in_l.scale = Vec3::one() * 1.05;
next.wing_in_l.scale = Vec3::one();
next.wing_in_r.offset = Vec3::new(
skeleton_attr.wing_in.0,
@ -137,7 +136,7 @@ impl Animation for FlyAnimation {
skeleton_attr.wing_in.2,
);
next.wing_in_r.ori = Quaternion::rotation_y(-0.4 + wingr * 0.6);
next.wing_in_r.scale = Vec3::one() * 1.05;
next.wing_in_r.scale = Vec3::one();
next.wing_out_l.offset = Vec3::new(
-skeleton_attr.wing_out.0,
@ -153,7 +152,7 @@ impl Animation for FlyAnimation {
skeleton_attr.wing_out.2,
);
next.wing_out_r.ori = Quaternion::rotation_y((-0.35 + wingr * 0.6).min(-0.2));
next.wing_out_r.scale = Vec3::one() * 1.05;
next.wing_out_r.scale = Vec3::one();
next
}

View File

@ -1,5 +1,5 @@
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
use std::ops::Mul;
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -18,8 +18,8 @@ impl Animation for IdleAnimation {
let mut next = (*skeleton).clone();
let ultra_slow = (anim_time as f32 * 1.0).sin();
let wave_slow = (anim_time as f32 * 2.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let slow = (anim_time as f32 * 2.5).sin();
let slowalt = (anim_time as f32 * 2.5+PI/2.0).sin();
let dragon_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
@ -38,115 +38,115 @@ impl Animation for IdleAnimation {
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + ultra_slow * 0.20,
) * 1.05;
);
next.head_upper.ori =
Quaternion::rotation_z(0.8 * dragon_look.x) * Quaternion::rotation_x(0.8 * dragon_look.y);
next.head_upper.scale = Vec3::one() * 1.05;
next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + ultra_slow * 0.20,
) * 1.05;
);
next.head_lower.ori =
Quaternion::rotation_z(0.8 * dragon_look.x) * Quaternion::rotation_x(0.8 * dragon_look.y);
Quaternion::rotation_z(0.8 * dragon_look.x) * Quaternion::rotation_x(-0.2+0.8 * dragon_look.y);
next.head_lower.scale = Vec3::one() * 1.05;
next.jaw.offset = Vec3::new(
0.0,
skeleton_attr.jaw.0,
skeleton_attr.jaw.1,
) * 1.05;
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
);
next.jaw.ori = Quaternion::rotation_x(slow * 0.05);
next.jaw.scale = Vec3::one() * 0.98;
next.chest_front.offset = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1,
) * 1.05;
next.chest_front.ori = Quaternion::rotation_y(wave_slow * 0.03);
);
next.chest_front.ori = Quaternion::rotation_y(slow * 0.01);
next.chest_front.scale = Vec3::one() * 1.05;
next.chest_rear.offset = Vec3::new(
0.0,
skeleton_attr.chest_rear.0,
skeleton_attr.chest_rear.1,
) * 1.05;
next.chest_rear.ori = Quaternion::rotation_y(wave_slow * 0.03);
);
next.chest_rear.ori = Quaternion::rotation_y(slow * 0.01);
next.chest_rear.scale = Vec3::one() * 1.05;
next.tail_front.offset = Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.ori = Quaternion::rotation_x(wave_slow_cos * 0.03);
next.tail_front.scale = Vec3::one();
next.tail_front.ori = Quaternion::rotation_z(slowalt * 0.10)*Quaternion::rotation_x(0.1);
next.tail_front.scale = Vec3::one()*0.98;
next.tail_rear.offset = Vec3::new(0.0, skeleton_attr.tail_rear.0, skeleton_attr.tail_rear.1);
next.tail_rear.ori = Quaternion::rotation_x(wave_slow_cos * 0.03);
next.tail_rear.scale = Vec3::one();
next.tail_rear.ori = Quaternion::rotation_z(slowalt * 0.12)*Quaternion::rotation_x(0.05);
next.tail_rear.scale = Vec3::one()*0.98;
next.wing_in_l.offset = Vec3::new(
-skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_l.ori = Quaternion::rotation_y(0.2);
next.wing_in_l.scale = Vec3::one() * 1.05;
next.wing_in_l.ori = Quaternion::rotation_y(0.8);
next.wing_in_l.scale = Vec3::one();
next.wing_in_r.offset = Vec3::new(
skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_r.ori = Quaternion::rotation_y(-0.2);//.8
next.wing_in_r.scale = Vec3::one() * 1.05;
next.wing_in_r.ori = Quaternion::rotation_y(-0.8);
next.wing_in_r.scale = Vec3::one();
next.wing_out_l.offset = Vec3::new(
-skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_l.ori = Quaternion::rotation_y(-0.3);//2.0
next.wing_out_l.scale = Vec3::one() * 1.05;
next.wing_out_l.ori = Quaternion::rotation_y(-2.0);
next.wing_out_l.scale = Vec3::one();
next.wing_out_r.offset = Vec3::new(
skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_r.ori = Quaternion::rotation_y(0.3);
next.wing_out_r.scale = Vec3::one() * 1.05;
next.wing_out_r.ori = Quaternion::rotation_y(2.0);
next.wing_out_r.scale = Vec3::one();
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
) * 1.05;
);
next.foot_fl.ori = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() * 1.05;
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
) * 1.05;
);
next.foot_fr.ori = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() * 1.05;
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
) * 1.05;
);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() * 1.05;
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
) * 1.05;
);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() * 1.05;
next.foot_br.scale = Vec3::one();
next
}

View File

@ -236,10 +236,10 @@ impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
(Reddragon, _) => (-12.5, 0.0),
},
tail_front: match (body.species, body.body_type) {
(Reddragon, _) => (-12.5, 1.5),
(Reddragon, _) => (-6.5, 1.5),
},
tail_rear: match (body.species, body.body_type) {
(Reddragon, _) => (-14.0, 0.0),
(Reddragon, _) => (-11.5, -1.0),
},
wing_in: match (body.species, body.body_type) {
(Reddragon, _) => (2.5, -16.5, 0.0),

View File

@ -55,18 +55,18 @@ impl Animation for RunAnimation {
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1,
) * 1.05;
);
next.head_upper.ori =
Quaternion::rotation_x(dragon_look.y) * Quaternion::rotation_z(dragon_look.x);
next.head_upper.scale = Vec3::one() * 1.05;
next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1,
) * 1.05;
);
next.head_lower.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.head_lower.scale = Vec3::one() * 1.05;
next.head_lower.scale = Vec3::one();
next.jaw.offset = Vec3::new(
0.0,
@ -74,7 +74,7 @@ impl Animation for RunAnimation {
skeleton_attr.jaw.1 + wave_slow * 0.2,
);
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.jaw.scale = Vec3::one();
next.jaw.scale = Vec3::one()*0.98;
next.tail_front.offset = Vec3::new(
0.0,
@ -82,7 +82,7 @@ impl Animation for RunAnimation {
skeleton_attr.tail_front.1 + centeroffset * 0.6,
);
next.tail_front.ori = Quaternion::rotation_x(center * 0.03);
next.tail_front.scale = Vec3::one();
next.tail_front.scale = Vec3::one()*0.98;
next.tail_rear.offset = Vec3::new(
0.0,
@ -90,55 +90,55 @@ impl Animation for RunAnimation {
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
);
next.tail_rear.ori = Quaternion::rotation_x(center * 0.03);
next.tail_rear.scale = Vec3::one();
next.tail_rear.scale = Vec3::one()*0.98;
next.chest_front.offset = Vec3::new(
0.0,
skeleton_attr.chest_front.0 + horichest * 1.25,
skeleton_attr.chest_front.1 + vertchest * -1.6 + 1.0,
) * 1.05;
);
next.chest_front.ori = Quaternion::rotation_y(horichest * -0.09);
next.chest_front.scale = Vec3::one() * 1.05;
next.chest_front.scale = Vec3::one();
next.chest_rear.offset = Vec3::new(
0.0,
skeleton_attr.chest_rear.0,
skeleton_attr.chest_rear.1,
) * 1.05;
);
next.chest_rear.ori = Quaternion::rotation_y(horichest * -0.09);
next.chest_rear.scale = Vec3::one() * 1.05;
next.chest_rear.scale = Vec3::one();
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + horilf * 2.5,
skeleton_attr.feet_f.2 + vertlf * 5.0 * skeleton_attr.height - 0.5,
) * 1.05;
);
next.foot_fl.ori = Quaternion::rotation_x(horilf * 0.4);
next.foot_fl.scale = Vec3::one() * 1.05;
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + horirfoffset * 2.5,
skeleton_attr.feet_f.2 + vertrfoffset * 5.0 * skeleton_attr.height - 0.5,
) * 1.05;
);
next.foot_fr.ori = Quaternion::rotation_x(horirfoffset * 0.4);
next.foot_fr.scale = Vec3::one() * 1.05;
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + horilboffset * 3.0,
skeleton_attr.feet_b.2 + vertlboffset * 5.0 * skeleton_attr.height - 0.5,
) * 1.05;
);
next.foot_bl.ori = Quaternion::rotation_x(horilboffset * 0.35);
next.foot_bl.scale = Vec3::one() * 1.05;
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + horirb * 3.0,
skeleton_attr.feet_b.2 + vertrb * 5.0 * skeleton_attr.height - 0.5,
) * 1.05;
);
next.foot_br.ori = Quaternion::rotation_x(horirb * 0.35);
next.foot_br.scale = Vec3::one() * 1.05;
next.foot_br.scale = Vec3::one();
next.wing_in_l.offset = Vec3::new(
-skeleton_attr.wing_in.0,
@ -154,7 +154,7 @@ impl Animation for RunAnimation {
skeleton_attr.wing_in.2,
);
next.wing_in_r.ori = Quaternion::rotation_y(-0.8);
next.wing_in_r.scale = Vec3::one() * 1.05;
next.wing_in_r.scale = Vec3::one();
next.wing_out_l.offset = Vec3::new(
-skeleton_attr.wing_out.0,
@ -162,7 +162,7 @@ impl Animation for RunAnimation {
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_l.ori = Quaternion::rotation_y(-2.0);
next.wing_out_l.scale = Vec3::one() * 1.05;
next.wing_out_l.scale = Vec3::one();
next.wing_out_r.offset = Vec3::new(
skeleton_attr.wing_out.0,
@ -170,7 +170,7 @@ impl Animation for RunAnimation {
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_r.ori = Quaternion::rotation_y(2.0);
next.wing_out_r.scale = Vec3::one() * 1.05;
next.wing_out_r.scale = Vec3::one();
next
}