veloren/voxygen/anim/src/biped_small/mod.rs

513 lines
19 KiB
Rust
Raw Normal View History

2021-01-21 01:57:03 +00:00
pub mod alpha;
2021-09-01 07:58:19 +00:00
pub mod beam;
2024-01-20 17:45:23 +00:00
pub mod block;
2023-06-03 13:59:52 +00:00
pub mod combomelee;
2021-02-15 01:27:28 +00:00
pub mod dash;
2020-12-23 06:24:44 +00:00
pub mod idle;
2023-02-15 00:10:37 +00:00
pub mod leapmelee;
2024-01-20 17:45:23 +00:00
pub mod rapidmelee;
pub mod ripostemelee;
2020-12-23 06:24:44 +00:00
pub mod run;
2022-02-11 07:07:15 +00:00
pub mod shockwave;
2021-01-21 06:50:46 +00:00
pub mod shoot;
2021-03-12 05:38:41 +00:00
pub mod stunned;
2022-02-11 07:07:15 +00:00
pub mod summon;
2021-01-17 19:38:29 +00:00
pub mod wield;
2020-12-23 06:24:44 +00:00
// Reexports
2021-01-21 01:57:03 +00:00
pub use self::{
2024-01-20 17:45:23 +00:00
alpha::AlphaAnimation, beam::BeamAnimation, block::BlockAnimation, combomelee::ComboAnimation,
dash::DashAnimation, idle::IdleAnimation, leapmelee::LeapAnimation,
rapidmelee::RapidMeleeAnimation, ripostemelee::RiposteMeleeAnimation, run::RunAnimation,
2023-11-17 00:17:38 +00:00
shockwave::ShockwaveAnimation, shoot::ShootAnimation, stunned::StunnedAnimation,
summon::SummonAnimation, wield::WieldAnimation,
2021-01-21 01:57:03 +00:00
};
2020-12-23 06:24:44 +00:00
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
2020-12-23 06:24:44 +00:00
use common::comp::{self};
use core::convert::TryFrom;
2023-12-29 00:02:10 +00:00
use std::f32::consts::PI;
2020-12-23 06:24:44 +00:00
pub type Body = comp::biped_small::Body;
skeleton_impls!(struct BipedSmallSkeleton {
+ head,
+ chest,
+ pants,
2020-12-23 06:24:44 +00:00
+ tail,
+ main,
+ hand_l,
+ hand_r,
+ foot_l,
+ foot_r,
2021-01-17 19:38:29 +00:00
control,
control_l,
control_r,
2024-01-20 17:45:23 +00:00
:: // Begin non-bone fields
// Allows right hand to not be moved by control bone
detach_right: bool,
2020-12-23 06:24:44 +00:00
});
impl Skeleton for BipedSmallSkeleton {
type Attr = SkeletonAttr;
type Body = Body;
const BONE_COUNT: usize = 9;
#[cfg(feature = "use-dyn-lib")]
const COMPUTE_FN: &'static [u8] = b"biped_small_compute_mats\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_small_compute_mats")]
fn compute_matrices_inner(
&self,
base_mat: Mat4<f32>,
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
body: Self::Body,
) -> Offsets {
let base_mat = base_mat * Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 11.0);
2020-12-23 06:24:44 +00:00
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
let pants_mat = chest_mat * Mat4::<f32>::from(self.pants);
2021-01-17 19:38:29 +00:00
let control_mat = chest_mat * Mat4::<f32>::from(self.control);
let control_l_mat = Mat4::<f32>::from(self.control_l);
let control_r_mat = Mat4::<f32>::from(self.control_r);
2022-11-02 02:00:40 +00:00
let head_mat = chest_mat * Mat4::<f32>::from(self.head);
2020-12-23 06:24:44 +00:00
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
2022-11-02 02:00:40 +00:00
make_bone(head_mat),
2020-12-23 06:24:44 +00:00
make_bone(chest_mat),
make_bone(pants_mat),
make_bone(pants_mat * Mat4::<f32>::from(self.tail)),
2021-01-17 19:38:29 +00:00
make_bone(control_mat * Mat4::<f32>::from(self.main)),
make_bone(control_mat * control_l_mat * Mat4::<f32>::from(self.hand_l)),
2024-01-20 17:45:23 +00:00
make_bone(
if self.detach_right {
chest_mat
} else {
control_mat
} * control_r_mat
* Mat4::<f32>::from(self.hand_r),
),
2020-12-23 06:24:44 +00:00
make_bone(base_mat * Mat4::<f32>::from(self.foot_l)),
2020-12-24 07:52:02 +00:00
make_bone(base_mat * Mat4::<f32>::from(self.foot_r)),
2020-12-23 06:24:44 +00:00
];
Offsets {
2021-07-24 14:05:36 +00:00
lantern: None,
2022-11-02 02:00:40 +00:00
viewpoint: Some((head_mat * Vec4::new(0.0, 0.0, 0.0, 1.0)).xyz()),
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
2022-07-15 12:08:04 +00:00
position: comp::Body::BipedSmall(body)
.mount_offset()
.into_tuple()
.into(),
..Default::default()
},
2022-02-21 16:23:36 +00:00
primary_trail_mat: None,
secondary_trail_mat: None,
}
2020-12-23 06:24:44 +00:00
}
}
pub struct SkeletonAttr {
head: (f32, f32),
chest: (f32, f32),
pants: (f32, f32),
2020-12-23 06:24:44 +00:00
tail: (f32, f32),
hand: (f32, f32, f32),
foot: (f32, f32, f32),
2021-01-17 19:38:29 +00:00
grip: (f32, f32, f32),
2021-02-20 20:38:27 +00:00
scaler: f32,
2020-12-23 06:24:44 +00:00
}
2022-07-15 12:08:04 +00:00
impl<'a> TryFrom<&'a comp::Body> for SkeletonAttr {
2020-12-23 06:24:44 +00:00
type Error = ();
fn try_from(body: &'a comp::Body) -> Result<Self, Self::Error> {
match body {
comp::Body::BipedSmall(body) => Ok(SkeletonAttr::from(body)),
_ => Err(()),
}
}
}
impl Default for SkeletonAttr {
fn default() -> Self {
Self {
head: (0.0, 0.0),
chest: (0.0, 0.0),
pants: (0.0, 0.0),
2020-12-23 06:24:44 +00:00
tail: (0.0, 0.0),
hand: (0.0, 0.0, 0.0),
foot: (0.0, 0.0, 0.0),
2021-01-17 19:38:29 +00:00
grip: (0.0, 0.0, 0.0),
2021-02-20 20:38:27 +00:00
scaler: 0.0,
2020-12-23 06:24:44 +00:00
}
}
}
impl<'a> From<&'a Body> for SkeletonAttr {
fn from(body: &'a Body) -> Self {
use comp::biped_small::Species::*;
Self {
head: match (body.species, body.body_type) {
2020-12-24 07:52:02 +00:00
(Gnome, _) => (-1.0, 9.0),
2020-12-27 15:01:02 +00:00
(Sahagin, _) => (7.0, -3.5),
(Adlet, _) => (0.0, 7.0),
2021-01-13 23:45:56 +00:00
(Gnarling, _) => (0.0, 6.0),
(Mandragora, _) => (-1.0, 9.0),
(Kappa, _) => (8.0, 3.5),
(Cactid, _) => (0.0, 7.0),
(Gnoll, _) => (5.5, -1.0),
(Haniwa, _) => (0.0, 7.0),
(Myrmidon, _) => (0.0, 8.0),
2021-03-24 02:28:49 +00:00
(Husk, _) => (0.5, 8.5),
2023-02-15 00:10:37 +00:00
(Boreal, _) => (-0.5, 13.0),
2023-06-03 13:59:52 +00:00
(Bushly, _) => (-1.0, 9.0),
(Irrwurz, _) => (-1.0, 9.0),
2023-07-09 20:03:09 +00:00
(Clockwork, _) => (3.0, 3.5),
(Flamekeeper, _) => (3.0, 3.5),
2020-12-23 06:24:44 +00:00
},
chest: match (body.species, body.body_type) {
2020-12-24 07:52:02 +00:00
(Gnome, _) => (0.0, 9.0),
2020-12-27 15:01:02 +00:00
(Sahagin, _) => (0.0, 15.0),
(Adlet, _) => (0.0, 11.0),
2021-01-13 23:45:56 +00:00
(Gnarling, _) => (0.0, 7.5),
2022-02-05 08:08:01 +00:00
(Mandragora, _) => (0.0, 4.0),
2021-01-13 23:45:56 +00:00
(Kappa, _) => (0.0, 14.5),
(Cactid, _) => (0.0, 7.0),
(Gnoll, _) => (0.0, 15.5),
(Haniwa, _) => (0.0, 11.0),
(Myrmidon, _) => (0.0, 11.0),
2021-03-27 17:12:55 +00:00
(Husk, _) => (0.0, 13.0),
2023-02-15 00:10:37 +00:00
(Boreal, _) => (0.0, 12.0),
2023-06-03 13:59:52 +00:00
(Bushly, _) => (0.0, 4.0),
(Irrwurz, _) => (0.0, 6.0),
2023-07-09 20:03:09 +00:00
(Clockwork, _) => (0.0, 14.0),
(Flamekeeper, _) => (0.0, 14.0),
2020-12-23 06:24:44 +00:00
},
pants: match (body.species, body.body_type) {
2020-12-24 07:52:02 +00:00
(Gnome, _) => (0.0, -3.0),
2020-12-27 15:01:02 +00:00
(Sahagin, _) => (0.5, -7.0),
(Adlet, _) => (0.0, -3.0),
2021-01-13 23:45:56 +00:00
(Gnarling, _) => (0.0, -3.0),
2022-02-05 08:08:01 +00:00
(Mandragora, _) => (0.0, 0.0),
2021-01-13 23:45:56 +00:00
(Kappa, _) => (0.0, -3.0),
(Cactid, _) => (0.0, -3.0),
(Gnoll, _) => (0.5, -7.5),
(Haniwa, _) => (0.0, -3.5),
(Myrmidon, _) => (0.0, -3.0),
2021-03-27 17:12:55 +00:00
(Husk, _) => (-1.0, -3.0),
2023-02-15 00:10:37 +00:00
(Boreal, _) => (1.5, -5.0),
2023-06-03 13:59:52 +00:00
(Bushly, _) => (0.0, 1.0),
(Irrwurz, _) => (-5.5, -0.5),
2023-07-09 20:03:09 +00:00
(Clockwork, _) => (-1.0, -8.0),
(Flamekeeper, _) => (-1.0, -8.0),
2020-12-23 06:24:44 +00:00
},
tail: match (body.species, body.body_type) {
2020-12-24 07:52:02 +00:00
(Gnome, _) => (0.0, 0.0),
2020-12-27 15:01:02 +00:00
(Sahagin, _) => (-2.5, -2.0),
(Adlet, _) => (-4.5, -2.0),
2021-01-13 23:45:56 +00:00
(Gnarling, _) => (-2.0, 1.5),
2021-01-17 19:38:29 +00:00
(Mandragora, _) => (0.0, -1.0),
(Kappa, _) => (0.0, -4.0),
(Cactid, _) => (0.0, 0.0),
(Gnoll, _) => (-2.5, -2.0),
(Haniwa, _) => (-4.5, -2.0),
(Myrmidon, _) => (-2.5, -1.0),
2021-03-24 02:28:49 +00:00
(Husk, _) => (0.0, 0.0),
2023-02-15 00:10:37 +00:00
(Boreal, _) => (0.0, 0.0),
2023-06-03 13:59:52 +00:00
(Bushly, _) => (0.0, -1.0),
(Irrwurz, _) => (0.0, -1.0),
2023-07-09 20:03:09 +00:00
(Clockwork, _) => (0.0, 0.0),
(Flamekeeper, _) => (0.0, 0.0),
2020-12-23 06:24:44 +00:00
},
hand: match (body.species, body.body_type) {
2021-01-17 19:38:29 +00:00
(Gnome, _) => (4.0, 0.5, -1.0),
(Sahagin, _) => (3.5, 3.5, -2.0),
(Adlet, _) => (4.5, -0.5, 2.0),
(Gnarling, _) => (4.0, 0.0, 1.5),
2022-02-05 08:08:01 +00:00
(Mandragora, _) => (4.0, -0.5, 4.0),
2021-01-17 19:38:29 +00:00
(Kappa, _) => (4.0, 3.5, -0.5),
(Cactid, _) => (4.0, 0.5, -1.0),
(Gnoll, _) => (3.5, 0.5, -1.0),
(Haniwa, _) => (4.25, -1.0, 1.5),
(Myrmidon, _) => (3.5, 1.5, 2.0),
2021-03-24 02:28:49 +00:00
(Husk, _) => (4.0, 0.0, 1.0),
2023-02-15 00:10:37 +00:00
(Boreal, _) => (5.0, 0.5, 5.0),
2023-06-03 13:59:52 +00:00
(Bushly, _) => (5.0, 2.0, 8.0),
(Irrwurz, _) => (3.5, 2.0, 3.0),
2023-07-09 20:03:09 +00:00
(Clockwork, _) => (4.0, 1.5, -3.5),
(Flamekeeper, _) => (4.0, 1.5, -3.5),
2020-12-23 06:24:44 +00:00
},
foot: match (body.species, body.body_type) {
2020-12-24 07:52:02 +00:00
(Gnome, _) => (3.0, 0.0, 4.0),
2020-12-27 15:01:02 +00:00
(Sahagin, _) => (3.0, 1.0, 8.0),
(Adlet, _) => (3.0, 0.5, 7.0),
2021-01-13 23:45:56 +00:00
(Gnarling, _) => (2.5, 1.0, 5.0),
(Mandragora, _) => (3.0, 0.0, 4.0),
(Kappa, _) => (3.0, 3.0, 9.0),
(Cactid, _) => (3.0, 0.0, 5.0),
(Gnoll, _) => (3.0, 1.0, 7.0),
(Haniwa, _) => (3.0, 0.5, 8.0),
(Myrmidon, _) => (3.0, 0.5, 7.0),
2021-03-24 02:28:49 +00:00
(Husk, _) => (4.0, 0.5, 7.0),
2023-02-15 00:10:37 +00:00
(Boreal, _) => (3.0, 0.0, 9.0),
2023-06-03 13:59:52 +00:00
(Bushly, _) => (2.5, 0.0, 7.0),
(Irrwurz, _) => (4.0, 0.0, 6.0),
2023-07-09 20:03:09 +00:00
(Clockwork, _) => (3.5, 3.0, 7.0),
(Flamekeeper, _) => (3.5, 3.0, 7.0),
2020-12-23 06:24:44 +00:00
},
2021-01-17 19:38:29 +00:00
grip: match (body.species, body.body_type) {
(Gnome, _) => (0.0, 0.0, 5.0),
(Sahagin, _) => (1.0, 0.0, 13.0),
(Adlet, _) => (0.0, 0.0, 7.0),
(Gnarling, _) => (0.0, 0.0, 7.0),
(Mandragora, _) => (0.0, 0.0, 7.0),
(Kappa, _) => (0.75, 1.0, 12.0),
(Cactid, _) => (0.0, 0.0, 8.0),
(Gnoll, _) => (1.0, 0.0, 9.0),
(Haniwa, _) => (0.0, 0.5, 8.0),
(Myrmidon, _) => (0.0, 0.0, 8.0),
2021-03-24 02:28:49 +00:00
(Husk, _) => (0.0, 0.0, 8.0),
2023-02-15 00:10:37 +00:00
(Boreal, _) => (1.0, 0.0, 5.0),
2023-06-03 13:59:52 +00:00
(Bushly, _) => (0.0, 0.0, 7.0),
(Irrwurz, _) => (0.0, 0.0, 7.0),
2023-07-09 20:03:09 +00:00
(Clockwork, _) => (0.0, 0.0, 8.0),
(Flamekeeper, _) => (0.0, 0.0, 8.0),
2021-01-17 19:38:29 +00:00
},
2021-02-20 20:38:27 +00:00
scaler: match (body.species, body.body_type) {
(Gnome, _) => 0.8,
(Sahagin, _) => 1.05,
(Adlet, _) => 1.0,
(Gnarling, _) => 0.8,
(Mandragora, _) => 0.8,
(Kappa, _) => 0.8,
(Cactid, _) => 0.8,
(Gnoll, _) => 0.8,
(Haniwa, _) => 1.12,
(Myrmidon, _) => 1.24,
(Husk, _) => 1.12,
2023-02-15 00:10:37 +00:00
(Boreal, _) => 1.0,
2023-06-03 13:59:52 +00:00
(Bushly, _) => 1.0,
(Irrwurz, _) => 1.0,
2023-07-09 20:03:09 +00:00
(Clockwork, _) => 1.5,
(Flamekeeper, _) => 4.0,
2021-02-20 20:38:27 +00:00
},
2020-12-23 06:24:44 +00:00
}
}
}
2023-12-29 00:02:10 +00:00
pub fn init_biped_small_alpha(next: &mut BipedSmallSkeleton, s_a: &SkeletonAttr) {
next.hand_l.position = Vec3::new(s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
next.hand_r.position = Vec3::new(-s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
}
pub fn biped_small_alpha_spear(
next: &mut BipedSmallSkeleton,
s_a: &SkeletonAttr,
move1abs: f32,
move2abs: f32,
2024-01-20 17:45:23 +00:00
anim_time: f32,
2023-12-29 00:02:10 +00:00
speednormcancel: f32,
) {
2024-01-20 17:45:23 +00:00
let fast = (anim_time * 10.0).sin();
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
2023-12-29 00:02:10 +00:00
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(move1abs * 0.2 + move2abs * 0.3)
* Quaternion::rotation_z(move1abs * -0.2 + move2abs * 0.6)
* Quaternion::rotation_y(move1abs * 0.3 + move2abs * -0.5);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_x(move1abs * -0.2 + move2abs * 0.3)
* Quaternion::rotation_z(move1abs * 0.5 + move2abs * -0.6);
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
next.pants.orientation = Quaternion::rotation_x(move1abs * 0.2 + move2abs * -0.3)
* Quaternion::rotation_z(move1abs * -0.2 + move2abs * 0.2);
next.control_l.position = Vec3::new(1.0 - s_a.grip.0 * 2.0, 2.0, -2.0);
next.control_r.position = Vec3::new(-1.0 + s_a.grip.0 * 2.0, 2.0, 2.0);
next.control.position = Vec3::new(
-3.0 + move1abs * -3.0 + move2abs * 5.0,
s_a.grip.2 + move1abs * -12.0 + move2abs * 17.0,
-s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + move2abs * 5.0,
);
next.control_l.orientation =
Quaternion::rotation_x(PI / 1.5 + move1abs * -1.5 + move2abs * 2.5)
* Quaternion::rotation_y(-0.3);
next.control_r.orientation =
Quaternion::rotation_x(PI / 1.5 + s_a.grip.0 * 0.2 + move1abs * -1.5 + move2abs * 2.5)
* Quaternion::rotation_y(0.5 + s_a.grip.0 * 0.2);
next.control.orientation = Quaternion::rotation_x(-1.35 + move1abs * -0.3 + move2abs * 0.5)
* Quaternion::rotation_z(move1abs * 1.0 + move2abs * -1.0)
* Quaternion::rotation_y(move2abs * 0.0);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_x(0.05 * fastalt * speednormcancel)
* Quaternion::rotation_z(fast * 0.15 * speednormcancel);
}
pub fn biped_small_alpha_axe(
next: &mut BipedSmallSkeleton,
s_a: &SkeletonAttr,
move1abs: f32,
move2abs: f32,
) {
next.head.orientation = Quaternion::rotation_z(move1abs * 0.3 + move2abs * -0.6);
next.control_l.position = Vec3::new(2.0 - s_a.grip.0 * 2.0, 1.0, 3.0);
next.control_r.position = Vec3::new(
9.0 + move1abs * -10.0 + s_a.grip.0 * 2.0,
-1.0 + move1abs * 2.0,
move1abs * 3.0 - 2.0,
);
next.control.position = Vec3::new(
-5.0 + move1abs * 5.0,
-1.0 + s_a.grip.2,
-1.0 + move1abs * 3.0 + -s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0,
);
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 + move2abs * 1.0)
* Quaternion::rotation_y(-0.0)
* Quaternion::rotation_z(-0.0);
next.control_r.orientation = Quaternion::rotation_x(0.5 + move1abs * 1.5 + s_a.grip.0 * 0.2)
* Quaternion::rotation_y(0.2 + s_a.grip.0 * 0.2)
* Quaternion::rotation_z(-0.0);
next.control.orientation = Quaternion::rotation_x(-0.3 + move2abs * -1.0)
* Quaternion::rotation_y(move1abs * -0.9 + move2abs * 2.0)
* Quaternion::rotation_z(-0.3);
}
pub fn biped_small_alpha_dagger(
next: &mut BipedSmallSkeleton,
s_a: &SkeletonAttr,
move1abs: f32,
move2abs: f32,
) {
next.head.orientation = Quaternion::rotation_x(move1abs * 0.15 + move2abs * -0.15)
* Quaternion::rotation_z(move1abs * 0.15 + move2abs * -0.3);
next.control_l.position = Vec3::new(2.0 - s_a.grip.0 * 2.0, 1.0, 3.0);
next.control_r.position = Vec3::new(
9.0 + move1abs * -7.0 + s_a.grip.0 * 2.0,
-1.0 + move1abs * 6.0,
-2.0,
);
next.control.position = Vec3::new(
-5.0 + move1abs * 5.0 + move2abs * 9.0,
-1.0 + move2abs * -3.0 + s_a.grip.2,
-1.0 + move1abs * 3.0 + -s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0,
);
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_y(-0.0)
* Quaternion::rotation_z(-0.0);
next.control_r.orientation = Quaternion::rotation_x(0.5 + move1abs * 1.5 + s_a.grip.0 * 0.2)
* Quaternion::rotation_y(0.2 + s_a.grip.0 * 0.2)
* Quaternion::rotation_z(-0.0);
next.control.orientation = Quaternion::rotation_x(-0.3 + move2abs * -1.0)
* Quaternion::rotation_y(move1abs * -0.4 + move2abs * 1.0)
* Quaternion::rotation_z(-0.3 + move2abs * -2.2);
}
2024-01-20 17:45:23 +00:00
pub fn biped_small_wield_sword(
next: &mut BipedSmallSkeleton,
s_a: &SkeletonAttr,
speednorm: f32,
slow: f32,
) {
next.control_l.position = Vec3::new(2.0 - s_a.grip.0 * 2.0, 1.0, 3.0);
next.control_r.position = Vec3::new(9.0 + s_a.grip.0 * 2.0, -1.0, -2.0 + speednorm * -3.0);
next.control.position = Vec3::new(
-5.0,
-1.0 + s_a.grip.2,
-1.0 + -s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + speednorm * 2.0,
);
next.control_l.orientation = Quaternion::rotation_x(PI / 2.0 + slow * 0.1)
* Quaternion::rotation_y(-0.0)
* Quaternion::rotation_z(-0.0);
next.control_r.orientation = Quaternion::rotation_x(0.5 + slow * 0.1 + s_a.grip.0 * 0.2)
* Quaternion::rotation_y(0.2 + slow * 0.0 + s_a.grip.0 * 0.2)
* Quaternion::rotation_z(-0.0);
next.control.orientation = Quaternion::rotation_x(-0.3 + 0.2 * speednorm)
* Quaternion::rotation_y(-0.2 * speednorm)
* Quaternion::rotation_z(-0.3);
}
pub fn biped_small_wield_spear(
next: &mut BipedSmallSkeleton,
s_a: &SkeletonAttr,
anim_time: f32,
speed: f32,
fastacc: f32,
) {
let speednorm = speed / 9.4;
let speednormcancel = 1.0 - speednorm;
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
let slow = (anim_time * 2.0).sin();
next.control_l.position = Vec3::new(1.0 - s_a.grip.0 * 2.0, 2.0, -2.0);
next.control_r.position = Vec3::new(-1.0 + s_a.grip.0 * 2.0, 2.0, 2.0);
next.control.position = Vec3::new(
-3.0,
s_a.grip.2,
-s_a.grip.2 / 2.5
+ s_a.grip.0 * -2.0
+ fastacc * 1.5
+ fastalt * 0.5 * speednormcancel
+ speednorm * 2.0,
);
next.control_l.orientation =
Quaternion::rotation_x(PI / 1.5 + slow * 0.1) * Quaternion::rotation_y(-0.3);
next.control_r.orientation = Quaternion::rotation_x(PI / 1.5 + slow * 0.1 + s_a.grip.0 * 0.2)
* Quaternion::rotation_y(0.5 + slow * 0.0 + s_a.grip.0 * 0.2);
next.control.orientation = Quaternion::rotation_x(-1.35 + 0.5 * speednorm);
}
pub fn biped_small_wield_bow(
next: &mut BipedSmallSkeleton,
s_a: &SkeletonAttr,
anim_time: f32,
speed: f32,
fastacc: f32,
) {
let speednorm = speed / 9.4;
let speednormcancel = 1.0 - speednorm;
let fastalt = (anim_time * 10.0 + PI / 2.0).sin();
let slow = (anim_time * 2.0).sin();
next.control_l.position = Vec3::new(1.0 - s_a.grip.0 * 2.0, 0.0, 0.0);
next.control_r.position = Vec3::new(-1.0 + s_a.grip.0 * 2.0, 6.0, -2.0);
next.control.position = Vec3::new(
-1.0,
2.0 + s_a.grip.2,
3.0 + -s_a.grip.2 / 2.5
+ s_a.grip.0 * -2.0
+ fastacc * 1.5
+ fastalt * 0.5 * speednormcancel
+ speednorm * 2.0,
);
next.control_l.orientation =
Quaternion::rotation_x(PI / 2.0 + slow * 0.1) * Quaternion::rotation_y(-0.3);
next.control_r.orientation = Quaternion::rotation_x(PI / 2.0 + slow * 0.1 + s_a.grip.0 * 0.2)
* Quaternion::rotation_y(0.5 + slow * 0.0 + s_a.grip.0 * 0.2);
next.control.orientation =
Quaternion::rotation_x(-0.3 + 0.5 * speednorm) * Quaternion::rotation_y(0.5 * speednorm);
}