mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'snowram/mounts-animations' into 'master'
Improve mount animation See merge request veloren/veloren!2313
This commit is contained in:
commit
cee4dccb44
@ -159,7 +159,7 @@
|
||||
central: ("npc.tuskram.male.neck"),
|
||||
),
|
||||
jaw: (
|
||||
offset: (-5.0, 0.0, -1.5),
|
||||
offset: (-5.0, 0.0, -8.0),
|
||||
central: ("npc.tuskram.male.jaw"),
|
||||
),
|
||||
torso_front: (
|
||||
|
@ -764,12 +764,68 @@ impl Body {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn mounting_offset(&self) -> Vec3<f32> {
|
||||
/// Component of the mounting offset specific to the mountee
|
||||
pub fn mountee_offset(&self) -> Vec3<f32> {
|
||||
match self {
|
||||
Body::Ship(ship::Body::DefaultAirship) => Vec3::from([0.0, 0.0, 10.0]),
|
||||
Body::Ship(ship::Body::AirBalloon) => Vec3::from([0.0, 0.0, 5.0]),
|
||||
_ => Vec3::unit_z(),
|
||||
Body::QuadrupedMedium(quadruped_medium) => {
|
||||
match (quadruped_medium.species, quadruped_medium.body_type) {
|
||||
(quadruped_medium::Species::Grolgar, _) => [0.5, 0.5, 1.8],
|
||||
(quadruped_medium::Species::Saber, _) => [0.3, 0.3, 1.3],
|
||||
(quadruped_medium::Species::Tiger, _) => [0.2, 0.2, 1.4],
|
||||
(quadruped_medium::Species::Tuskram, _) => [-0.5, -0.5, 1.5],
|
||||
(quadruped_medium::Species::Lion, _) => [0.3, 0.3, 1.5],
|
||||
(quadruped_medium::Species::Tarasque, _) => [0.6, 0.6, 2.0],
|
||||
(quadruped_medium::Species::Wolf, _) => [0.5, 0.5, 1.3],
|
||||
(quadruped_medium::Species::Frostfang, _) => [0.5, 0.5, 1.2],
|
||||
(quadruped_medium::Species::Mouflon, _) => [0.3, 0.3, 1.2],
|
||||
(quadruped_medium::Species::Catoblepas, _) => [0.0, 0.0, 2.0],
|
||||
(quadruped_medium::Species::Bonerattler, _) => [0.5, 0.5, 1.2],
|
||||
(quadruped_medium::Species::Deer, _) => [0.2, 0.2, 1.3],
|
||||
(quadruped_medium::Species::Hirdrasil, _) => [0.0, 0.0, 1.4],
|
||||
(quadruped_medium::Species::Roshwalr, _) => [0.5, 0.5, 1.8],
|
||||
(quadruped_medium::Species::Donkey, _) => [0.5, 0.5, 1.5],
|
||||
(quadruped_medium::Species::Camel, _) => [-0.1, -0.1, 2.8],
|
||||
(quadruped_medium::Species::Zebra, _) => [0.5, 0.5, 1.8],
|
||||
(quadruped_medium::Species::Antelope, _) => [0.3, 0.3, 1.4],
|
||||
(quadruped_medium::Species::Kelpie, _) => [0.5, 0.5, 1.9],
|
||||
(quadruped_medium::Species::Horse, _) => [0.0, 0.0, 2.0],
|
||||
(quadruped_medium::Species::Barghest, _) => [0.5, 0.5, 2.2],
|
||||
(quadruped_medium::Species::Cattle, quadruped_medium::BodyType::Male) => {
|
||||
[0.5, 0.5, 2.6]
|
||||
},
|
||||
(quadruped_medium::Species::Cattle, quadruped_medium::BodyType::Female) => {
|
||||
[0.7, 0.7, 2.2]
|
||||
},
|
||||
(quadruped_medium::Species::Darkhound, _) => [0.5, 0.5, 1.4],
|
||||
(quadruped_medium::Species::Highland, _) => [0.5, 0.5, 2.3],
|
||||
(quadruped_medium::Species::Yak, _) => [0.0, 0.0, 3.0],
|
||||
(quadruped_medium::Species::Panda, _) => [-0.2, -0.2, 1.4],
|
||||
(quadruped_medium::Species::Bear, _) => [-0.4, -0.4, 2.5],
|
||||
(quadruped_medium::Species::Dreadhorn, _) => [0.2, 0.2, 3.5],
|
||||
(quadruped_medium::Species::Moose, _) => [-0.6, -0.6, 2.1],
|
||||
(quadruped_medium::Species::Snowleopard, _) => [-0.5, -0.5, 1.4],
|
||||
(quadruped_medium::Species::Mammoth, _) => [0.0, 4.9, 7.2],
|
||||
(quadruped_medium::Species::Ngoubou, _) => [0.0, 0.3, 2.0],
|
||||
(quadruped_medium::Species::Llama, _) => [0.0, 0.1, 1.5],
|
||||
(quadruped_medium::Species::Alpaca, _) => [0.0, -0.1, 1.0],
|
||||
}
|
||||
},
|
||||
Body::Ship(ship) => match ship {
|
||||
ship::Body::DefaultAirship => [0.0, 0.0, 10.0],
|
||||
ship::Body::AirBalloon => [0.0, 0.0, 5.0],
|
||||
},
|
||||
_ => [0.0, 0.0, 0.0],
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Component of the mounting offset specific to the mounter
|
||||
pub fn mounter_offset(&self) -> Vec3<f32> {
|
||||
match self {
|
||||
Body::Humanoid(_) => [0.0, 0.0, 0.0],
|
||||
_ => [0.0, 0.0, 0.0],
|
||||
}
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -352,11 +352,10 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
// Mounted occurs after control actions have been handled
|
||||
// If mounted, character state is controlled by mount
|
||||
// TODO: Make mounting a state
|
||||
if let Some(Mounting(_)) = read_data.mountings.get(entity) {
|
||||
let sit_state = CharacterState::Sit {};
|
||||
if join_struct.char_state.get_unchecked() != &sit_state {
|
||||
*join_struct.char_state.get_mut_unchecked() = sit_state;
|
||||
let idle_state = CharacterState::Idle {};
|
||||
if join_struct.char_state.get_unchecked() != &idle_state {
|
||||
*join_struct.char_state.get_mut_unchecked() = idle_state;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -66,9 +66,11 @@ impl<'a> System<'a> for Sys {
|
||||
let ori = orientations.get(entity).copied();
|
||||
let vel = velocities.get(entity).copied();
|
||||
if let (Some(pos), Some(ori), Some(vel)) = (pos, ori, vel) {
|
||||
let mounting_offset =
|
||||
body.map_or(Vec3::unit_z(), Body::mounting_offset);
|
||||
let _ = positions.insert(mounter, Pos(pos.0 + mounting_offset));
|
||||
let mounter_body = bodies.get(mounter);
|
||||
let mounting_offset = body.map_or(Vec3::unit_z(), Body::mountee_offset)
|
||||
+ mounter_body.map_or(Vec3::zero(), Body::mounter_offset);
|
||||
let _ = positions
|
||||
.insert(mounter, Pos(pos.0 + ori.to_quat() * mounting_offset));
|
||||
let _ = orientations.insert(mounter, ori);
|
||||
let _ = velocities.insert(mounter, vel);
|
||||
}
|
||||
|
@ -109,16 +109,20 @@ pub fn handle_mount(server: &mut Server, mounter: EcsEntity, mountee: EcsEntity)
|
||||
Some(comp::MountState::Unmounted)
|
||||
);
|
||||
|
||||
let within_range = within_mounting_range(
|
||||
state.ecs().read_storage::<comp::Pos>().get(mounter),
|
||||
state.ecs().read_storage::<comp::Pos>().get(mountee),
|
||||
);
|
||||
let within_range = || {
|
||||
let positions = state.ecs().read_storage::<comp::Pos>();
|
||||
within_mounting_range(positions.get(mounter), positions.get(mountee))
|
||||
};
|
||||
let healths = state.ecs().read_storage::<comp::Health>();
|
||||
let alive = |e| healths.get(e).map_or(true, |h| !h.is_dead);
|
||||
|
||||
if not_mounting_yet && within_range {
|
||||
if let (Some(mounter_uid), Some(mountee_uid)) = (
|
||||
state.ecs().uid_from_entity(mounter),
|
||||
state.ecs().uid_from_entity(mountee),
|
||||
) {
|
||||
if not_mounting_yet && within_range() && alive(mounter) && alive(mountee) {
|
||||
let uids = state.ecs().read_storage::<Uid>();
|
||||
if let (Some(mounter_uid), Some(mountee_uid)) =
|
||||
(uids.get(mounter).copied(), uids.get(mountee).copied())
|
||||
{
|
||||
drop(uids);
|
||||
drop(healths);
|
||||
// We know the entities must exist to be able to look up their UIDs, so these
|
||||
// are guaranteed to work; hence we can ignore possible errors here.
|
||||
state.write_component_ignore_entity_dead(
|
||||
|
@ -173,7 +173,7 @@ impl Animation for AlphaAnimation {
|
||||
if let Some(AbilitySpec::Custom(spec)) = active_tool_spec {
|
||||
match spec.as_str() {
|
||||
"Wendigo Magic" => {
|
||||
next.torso.position = Vec3::new(0.0, 0.0, move1 * -0.3);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, move1 * -2.18);
|
||||
next.upper_torso.orientation =
|
||||
Quaternion::rotation_x(move1 * -0.5 + move2 * -0.4);
|
||||
next.lower_torso.orientation =
|
||||
@ -262,7 +262,7 @@ impl Animation for AlphaAnimation {
|
||||
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
|
||||
};
|
||||
next.torso.position = Vec3::new(0.0, move2 * -2.2, move2 * -1.0);
|
||||
next.torso.position = Vec3::new(0.0, move2 * -10.35, move2 * -4.7);
|
||||
},
|
||||
"Minotaur" => {
|
||||
next.control_l.position = Vec3::new(0.0, 4.0, 5.0);
|
||||
|
@ -170,7 +170,7 @@ impl Animation for BetaAnimation {
|
||||
if let Some(AbilitySpec::Custom(spec)) = active_tool_spec {
|
||||
match spec.as_str() {
|
||||
"Wendigo Magic" => {
|
||||
next.torso.position = Vec3::new(0.0, 0.0, move1 * -0.3);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, move1 * -2.18);
|
||||
next.upper_torso.orientation =
|
||||
Quaternion::rotation_x(move1 * -0.5 + move2 * -0.4);
|
||||
next.lower_torso.orientation =
|
||||
@ -198,7 +198,7 @@ impl Animation for BetaAnimation {
|
||||
next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
|
||||
},
|
||||
"Tidal Claws" => {
|
||||
next.torso.position = Vec3::new(0.0, 0.0, move1 * -0.3);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, move1 * -1.4);
|
||||
next.upper_torso.orientation =
|
||||
Quaternion::rotation_x(move1 * -0.5 + move2 * -0.4);
|
||||
next.lower_torso.orientation =
|
||||
|
@ -121,7 +121,7 @@ impl Animation for ChargeMeleeAnimation {
|
||||
-6.0 + move1 * 22.0 + move2 * 8.0,
|
||||
-18.0 + move1 * 14.0 + move2 * -19.0,
|
||||
);
|
||||
next.torso.position = Vec3::new(0.0, move2 * 1.5, 0.0);
|
||||
next.torso.position = Vec3::new(0.0, move2 * 7.06, 0.0);
|
||||
next.second.scale = Vec3::one() * 1.0;
|
||||
|
||||
next.weapon_l.orientation =
|
||||
|
@ -62,7 +62,6 @@ impl Animation for IdleAnimation {
|
||||
next.hand_r.scale = Vec3::one() * 1.04;
|
||||
next.lower_torso.scale = Vec3::one() * 1.02;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
next.torso.scale = Vec3::one() / 8.0 * s_a.scaler;
|
||||
next.second.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + torso * 0.2);
|
||||
@ -137,7 +136,7 @@ impl Animation for IdleAnimation {
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0 * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
||||
if s_a.float {
|
||||
next.upper_torso.position = Vec3::new(
|
||||
|
@ -116,9 +116,8 @@ impl Animation for JumpAnimation {
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, 5.0 + s_a.foot.1, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.4);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0 * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 8.0 * s_a.scaler;
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ pub use self::{
|
||||
wield::WieldAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::{convert::TryFrom, f32::consts::PI};
|
||||
|
||||
@ -79,11 +79,12 @@ impl Skeleton for BipedLargeSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
let upper_torso = Mat4::<f32>::from(self.upper_torso);
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 8.0);
|
||||
|
||||
let torso_mat = base_mat * Mat4::<f32>::from(self.torso);
|
||||
let upper_torso_mat = torso_mat * upper_torso;
|
||||
let upper_torso_mat = torso_mat * Mat4::<f32>::from(self.upper_torso);
|
||||
let control_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);
|
||||
@ -126,7 +127,17 @@ impl Skeleton for BipedLargeSkeleton {
|
||||
// FIXME: Should this be control_l_mat?
|
||||
make_bone(upper_torso_mat * control_mat * hand_l_mat * Mat4::<f32>::from(self.hold)),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::BipedLarge(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,6 @@ impl Animation for RunAnimation {
|
||||
next.hand_l.scale = Vec3::one() * 1.04;
|
||||
next.hand_r.scale = Vec3::one() * 1.04;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
next.torso.scale = Vec3::one() / 8.0 * s_a.scaler;
|
||||
next.second.scale = Vec3::one() * 0.0;
|
||||
|
||||
if s_a.beast {
|
||||
@ -256,10 +255,9 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.torso.position = Vec3::new(
|
||||
0.0,
|
||||
0.0 + (short * 0.75).max(-2.0),
|
||||
speedavg * 0.15 + (short * 0.75).max(-2.0),
|
||||
) / 8.0
|
||||
* s_a.scaler;
|
||||
0.0 + (short * 6.0).max(-16.0),
|
||||
speedavg * 1.2 + (short * 6.0).max(-16.0),
|
||||
);
|
||||
next.torso.orientation =
|
||||
Quaternion::rotation_x(x_tilt + amplitude * short * 0.1 + speedavg * -0.045);
|
||||
} else {
|
||||
@ -410,7 +408,7 @@ impl Animation for RunAnimation {
|
||||
tilt * 1.0 + side * 0.3 + side * (foothorir * 0.3),
|
||||
) * Quaternion::rotation_z(side * 0.2);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.orientation = Quaternion::rotation_x(-0.25 * speednorm);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ impl Animation for SpinMeleeAnimation {
|
||||
next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.5);
|
||||
|
||||
next.lower_torso.orientation = Quaternion::rotation_x(move1 * 0.8);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, move1 * 0.8);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, move1 * 6.4);
|
||||
},
|
||||
|
||||
_ => {},
|
||||
|
@ -133,7 +133,7 @@ impl Animation for SummonAnimation {
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1base * pullback;
|
||||
let move2 = move2base * pullback;
|
||||
next.torso.position = Vec3::new(0.0, 0.0 + move1 * 1.0, move1 * -4.0);
|
||||
next.torso.position = Vec3::new(0.0, 0.0 + move1 * 4.7, move1 * -18.8);
|
||||
next.upper_torso.position =
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
|
||||
|
||||
|
@ -74,7 +74,7 @@ impl Animation for AlphaAnimation {
|
||||
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) / 11.0;
|
||||
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);
|
||||
|
||||
|
@ -27,14 +27,9 @@ impl Animation for IdleAnimation {
|
||||
let mut next = (*skeleton).clone();
|
||||
let slow = (anim_time * 4.0).sin();
|
||||
|
||||
next.foot_l.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.foot_r.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 11.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 + slow * 0.3) * s_a.scaler / 11.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.3);
|
||||
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
|
||||
next.main.position = Vec3::new(2.0, -3.0, -3.0);
|
||||
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
@ -42,8 +37,8 @@ impl Animation for IdleAnimation {
|
||||
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 + slow * -0.1);
|
||||
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) * s_a.scaler / 11.0;
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) * s_a.scaler / 11.0;
|
||||
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
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ pub use self::{
|
||||
shoot::ShootAnimation, stunned::StunnedAnimation, wield::WieldAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -47,7 +47,10 @@ impl Skeleton for BipedSmallSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 11.0);
|
||||
|
||||
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
|
||||
let pants_mat = chest_mat * Mat4::<f32>::from(self.pants);
|
||||
let control_mat = chest_mat * Mat4::<f32>::from(self.control);
|
||||
@ -64,7 +67,17 @@ impl Skeleton for BipedSmallSkeleton {
|
||||
make_bone(base_mat * Mat4::<f32>::from(self.foot_l)),
|
||||
make_bone(base_mat * Mat4::<f32>::from(self.foot_r)),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::BipedSmall(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,9 +78,6 @@ impl Animation for RunAnimation {
|
||||
(global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2,
|
||||
(global_time + anim_time / 18.0).floor().mul(1137.0).sin() * 0.1,
|
||||
);
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.foot_l.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.foot_r.scale = Vec3::one() * s_a.scaler / 11.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)
|
||||
@ -90,8 +87,7 @@ impl Animation for RunAnimation {
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + 1.0 * speednorm + shortalt * -0.8,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_z(short * 0.06 + tilt * -0.6)
|
||||
* Quaternion::rotation_y(tilt * 1.6)
|
||||
* Quaternion::rotation_x(shortalter * 0.035 + speednorm * -0.4 + (tilt.abs()));
|
||||
@ -121,7 +117,6 @@ impl Animation for RunAnimation {
|
||||
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
|
||||
@ -130,8 +125,7 @@ impl Animation for RunAnimation {
|
||||
s_a.foot.2
|
||||
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertl * -1.1 * speednorm).max(-1.0)))
|
||||
+ side * ((footvertsl * 1.5).max(-1.0)),
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(
|
||||
(1.0 - sideabs) * (-0.2 * speednorm + foothoril * -0.9 * speednorm) + sideabs * -0.5,
|
||||
) * Quaternion::rotation_y(
|
||||
@ -146,8 +140,7 @@ impl Animation for RunAnimation {
|
||||
s_a.foot.2
|
||||
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertr * -1.1 * speednorm).max(-1.0)))
|
||||
+ side * ((footvertsr * -1.5).max(-1.0)),
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(
|
||||
(1.0 - sideabs) * (-0.2 * speednorm + foothorir * -0.9 * speednorm) + sideabs * -0.5,
|
||||
) * Quaternion::rotation_y(
|
||||
|
@ -61,8 +61,7 @@ impl Animation for ShootAnimation {
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + fastalt * 0.4 * speednormcancel + speednormcancel * -0.5,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
|
||||
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
|
||||
|
||||
|
@ -66,8 +66,7 @@ impl Animation for StunnedAnimation {
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_x(movement1 * 0.2) * Quaternion::rotation_z(movement1 * -0.3);
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1abs - 3.0) * s_a.scaler / 11.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1abs - 3.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(movement1 * 1.2);
|
||||
|
||||
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
|
||||
@ -162,13 +161,9 @@ impl Animation for StunnedAnimation {
|
||||
_ => {},
|
||||
}
|
||||
} else {
|
||||
next.foot_l.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.foot_r.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
|
||||
next.main.position = Vec3::new(2.0, -3.0, -3.0);
|
||||
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
||||
@ -176,11 +171,10 @@ impl Animation for StunnedAnimation {
|
||||
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) * s_a.scaler / 11.0;
|
||||
next.foot_r.position =
|
||||
Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) * s_a.scaler / 11.0;
|
||||
};
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,7 @@ impl Animation for WieldAnimation {
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + fastalt * 0.4 * speednormcancel + speednormcancel * -0.5,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
|
||||
next.pants.position = Vec3::new(0.0, s_a.pants.0, s_a.pants.1);
|
||||
|
||||
|
@ -53,14 +53,12 @@ impl Animation for AlphaAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06) * s_a.scaler / 8.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06);
|
||||
next.chest.orientation = Quaternion::rotation_x(move1 * 0.5 - move2 * 0.8);
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
|
@ -53,18 +53,16 @@ impl Animation for BreatheAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + wave_slow_cos * 0.06 + twitch2 * 0.1,
|
||||
) * s_a.scaler
|
||||
/ 8.0;
|
||||
);
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
next.neck.orientation = Quaternion::rotation_x(movement1abs * 0.5 - movement2abs * 0.5);
|
||||
|
@ -89,11 +89,10 @@ impl Animation for DashAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(
|
||||
@ -114,8 +113,7 @@ impl Animation for DashAnimation {
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + short * 0.5 + 0.5 * speednorm,
|
||||
) * s_a.scaler
|
||||
/ 8.0;
|
||||
);
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(short * 0.07 + movement1abs * 0.8 + movement2abs * -1.2)
|
||||
* Quaternion::rotation_y(tilt * 0.8)
|
||||
|
@ -41,15 +41,12 @@ impl Animation for FeedAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 - 1.8)
|
||||
* s_a.scaler
|
||||
/ 8.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 - 1.8);
|
||||
next.chest.orientation = Quaternion::rotation_x(s_a.feed);
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
@ -85,9 +82,9 @@ impl Animation for FeedAnimation {
|
||||
next.wing_out_l.orientation = Quaternion::rotation_y(-0.2) * Quaternion::rotation_z(0.2);
|
||||
next.wing_out_r.orientation = Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(0.0);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
|
@ -60,11 +60,10 @@ impl Animation for FlyAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
next.neck.orientation =
|
||||
@ -79,8 +78,7 @@ impl Animation for FlyAnimation {
|
||||
next.beak.position = Vec3::new(0.0, s_a.beak.0, s_a.beak.1);
|
||||
|
||||
if velocity.z > 2.0 || velocity.xy().magnitude() < 12.0 {
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 - flap4 * 1.5) * s_a.scaler / 8.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 - flap4 * 1.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(
|
||||
(0.8 - 0.8 * velocity.xy().magnitude() / 5.0).max(-0.2) - flap1 * 0.2,
|
||||
) * Quaternion::rotation_y(tilt * 1.8 + fast * 0.01);
|
||||
@ -110,11 +108,11 @@ impl Animation for FlyAnimation {
|
||||
next.tail_rear.orientation =
|
||||
Quaternion::rotation_x(-flap3 * 0.3 + 0.15) * Quaternion::rotation_z(-tilt * 0.8);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 - flap4 * 1.5) / 8.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 - flap4 * 1.5);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(
|
||||
(-1.0 * velocity.xy().magnitude() / 5.0).max(-1.2) + flap1 * -0.1,
|
||||
) * Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 - flap4 * 1.5) / 8.0;
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 - flap4 * 1.5);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(
|
||||
(-1.0 * velocity.xy().magnitude() / 5.0).max(-1.2) + flap1 * -0.1,
|
||||
) * Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
|
||||
@ -124,8 +122,7 @@ impl Animation for FlyAnimation {
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(flap1 * -0.1);
|
||||
} else {
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.05) * s_a.scaler / 8.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.05);
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(-0.2 + slow * 0.05 + (0.8 * velocity.z / 80.0).min(0.8))
|
||||
* Quaternion::rotation_y(tilt * 1.8 + fast * 0.01);
|
||||
@ -159,10 +156,10 @@ impl Animation for FlyAnimation {
|
||||
next.tail_rear.orientation =
|
||||
Quaternion::rotation_x(slow * 0.08) * Quaternion::rotation_z(-tilt * 0.8);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + slow * 0.05) / 8.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + slow * 0.05);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(-1.2 + slow * -0.05)
|
||||
* Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + slow * 0.05) / 8.0;
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + slow * 0.05);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(-1.2 + slow * -0.05)
|
||||
* Quaternion::rotation_y(tilt * 1.6 + fast * 0.01);
|
||||
|
||||
|
@ -39,15 +39,12 @@ impl Animation for IdleAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 + 1.5)
|
||||
* s_a.scaler
|
||||
/ 8.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 + 1.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
@ -83,9 +80,9 @@ impl Animation for IdleAnimation {
|
||||
next.wing_out_l.orientation = Quaternion::rotation_y(-0.4) * Quaternion::rotation_z(0.2);
|
||||
next.wing_out_r.orientation = Quaternion::rotation_y(0.4) * Quaternion::rotation_z(-0.2);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(0.0);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
|
@ -18,7 +18,7 @@ pub use self::{
|
||||
shoot::ShootAnimation, stunned::StunnedAnimation, summon::SummonAnimation, swim::SwimAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -57,7 +57,10 @@ impl Skeleton for BirdLargeSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 8.0);
|
||||
|
||||
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
|
||||
let neck_mat = chest_mat * Mat4::<f32>::from(self.neck);
|
||||
let head_mat = neck_mat * Mat4::<f32>::from(self.head);
|
||||
@ -93,7 +96,17 @@ impl Skeleton for BirdLargeSkeleton {
|
||||
make_bone(foot_l_mat),
|
||||
make_bone(foot_r_mat),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::BirdLarge(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,11 +67,10 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.1 * speednorm + short * -0.05)
|
||||
@ -90,8 +89,7 @@ impl Animation for RunAnimation {
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + short * 0.5 + 0.5 * speednorm,
|
||||
) * s_a.scaler
|
||||
/ 8.0;
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_x(short * 0.07)
|
||||
* Quaternion::rotation_y(tilt * 0.8)
|
||||
* Quaternion::rotation_z(shortalt * 0.10);
|
||||
@ -124,7 +122,7 @@ impl Animation for RunAnimation {
|
||||
-s_a.leg.0 + speednorm * 1.5,
|
||||
s_a.leg.1 + foot1b * -2.3,
|
||||
s_a.leg.2,
|
||||
) / 8.0;
|
||||
);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
|
||||
* Quaternion::rotation_y(tilt * 0.5);
|
||||
|
||||
@ -132,7 +130,7 @@ impl Animation for RunAnimation {
|
||||
s_a.leg.0 + speednorm * -1.5,
|
||||
s_a.leg.1 + foot2b * -2.3,
|
||||
s_a.leg.2,
|
||||
) / 8.0;
|
||||
);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
|
||||
* Quaternion::rotation_y(tilt * 0.5);
|
||||
|
||||
|
@ -40,14 +40,12 @@ impl Animation for ShockwaveAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1abs * 1.5) * s_a.scaler / 8.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1abs * 1.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(movement1abs * 1.0 + movement2abs * -1.0);
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
@ -89,9 +87,9 @@ impl Animation for ShockwaveAnimation {
|
||||
next.wing_out_r.orientation =
|
||||
Quaternion::rotation_y(0.4) * Quaternion::rotation_z(-0.2);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(0.0);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
|
@ -45,18 +45,16 @@ impl Animation for ShootAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + wave_slow_cos * 0.06 + twitch2 * 0.1,
|
||||
) * s_a.scaler
|
||||
/ 8.0;
|
||||
);
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation =
|
||||
|
@ -39,14 +39,12 @@ impl Animation for StunnedAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06) * s_a.scaler / 8.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06);
|
||||
next.chest.orientation = Quaternion::rotation_x(movement1base * 0.5);
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
@ -79,9 +77,9 @@ impl Animation for StunnedAnimation {
|
||||
next.wing_out_l.orientation = Quaternion::rotation_y(-0.2) * Quaternion::rotation_z(0.2);
|
||||
next.wing_out_r.orientation = Quaternion::rotation_y(0.2) * Quaternion::rotation_z(-0.2);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(movement1abs * 0.8);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.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);
|
||||
|
@ -46,18 +46,16 @@ impl Animation for SummonAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + wave_slow_cos * 0.06 + twitch2 * 0.1,
|
||||
) * s_a.scaler
|
||||
/ 8.0;
|
||||
);
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation =
|
||||
|
@ -43,15 +43,12 @@ impl Animation for SwimAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 0.98;
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_r.scale = Vec3::one() / 8.0 * 0.98;
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 1.02;
|
||||
next.foot_r.scale = Vec3::one() * 1.02;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 + 1.5)
|
||||
* s_a.scaler
|
||||
/ 8.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_slow_cos * 0.06 + 1.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
@ -87,9 +84,9 @@ impl Animation for SwimAnimation {
|
||||
next.wing_out_l.orientation = Quaternion::rotation_y(-0.4) * Quaternion::rotation_z(0.2);
|
||||
next.wing_out_r.orientation = Quaternion::rotation_y(0.4) * Quaternion::rotation_z(-0.2);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(-0.8 + wave_fast * 0.5);
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) / 8.0;
|
||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(-0.8 + wave_fast_cos * 0.5);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
|
@ -50,7 +50,7 @@ impl Animation for FeedAnimation {
|
||||
0.0,
|
||||
s_a.chest.0 + s_a.feed,
|
||||
-1.0 - 5.0 * (s_a.feed - 1.0) + wave_slow * 0.3 + s_a.chest.1,
|
||||
) / 11.0;
|
||||
);
|
||||
next.torso.orientation =
|
||||
Quaternion::rotation_x(-0.5 * s_a.feed) * Quaternion::rotation_y(wave_slow * 0.03);
|
||||
|
||||
@ -63,9 +63,9 @@ impl Animation for FeedAnimation {
|
||||
next.wing_r.position = Vec3::new(s_a.wing.0, s_a.wing.1, s_a.wing.2);
|
||||
next.wing_r.orientation = Quaternion::rotation_y(-0.4 + wave_slow * 0.1);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
|
||||
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
|
||||
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -30,11 +30,8 @@ impl Animation for FlyAnimation {
|
||||
let center = (anim_time * lab + PI / 2.0).sin();
|
||||
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
||||
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
next.wing_l.scale = Vec3::one() * 1.05;
|
||||
next.wing_r.scale = Vec3::one() * 1.05;
|
||||
next.leg_l.scale = Vec3::one() / 11.0;
|
||||
next.leg_r.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 + 0.5, s_a.head.1 + center * 0.5 - 1.0);
|
||||
next.head.orientation =
|
||||
@ -44,7 +41,7 @@ impl Animation for FlyAnimation {
|
||||
0.0,
|
||||
s_a.chest.0 + centeroffset * 0.6,
|
||||
center * 0.6 + s_a.chest.1,
|
||||
) / 11.0;
|
||||
);
|
||||
next.torso.orientation = Quaternion::rotation_y(center * 0.05);
|
||||
|
||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1 + centeroffset * 0.6);
|
||||
@ -56,10 +53,10 @@ impl Animation for FlyAnimation {
|
||||
next.wing_r.position = Vec3::new(s_a.wing.0, s_a.wing.1, s_a.wing.2);
|
||||
next.wing_r.orientation = Quaternion::rotation_y((-0.57 + footr * 1.2).min(0.0));
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(-1.3 + footl * 0.06);
|
||||
|
||||
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
|
||||
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(-1.3 + footr * 0.06);
|
||||
next
|
||||
}
|
||||
|
@ -40,17 +40,14 @@ impl Animation for IdleAnimation {
|
||||
* 0.25,
|
||||
);
|
||||
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
next.wing_l.scale = Vec3::one() * 1.02;
|
||||
next.wing_r.scale = Vec3::one() * 1.02;
|
||||
next.leg_l.scale = Vec3::one() / 11.0;
|
||||
next.leg_r.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(duck_head_look.x)
|
||||
* Quaternion::rotation_x(-duck_head_look.y.abs() + wave_slow_cos * 0.03);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, s_a.chest.0, wave_slow * 0.3 + s_a.chest.1) / 11.0;
|
||||
next.torso.position = Vec3::new(0.0, s_a.chest.0, wave_slow * 0.3 + s_a.chest.1);
|
||||
next.torso.orientation = Quaternion::rotation_y(wave_slow * 0.03);
|
||||
|
||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||
@ -60,9 +57,9 @@ impl Animation for IdleAnimation {
|
||||
|
||||
next.wing_r.position = Vec3::new(s_a.wing.0, s_a.wing.1, s_a.wing.2);
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
|
||||
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
|
||||
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ pub mod run;
|
||||
// Reexports
|
||||
pub use self::{feed::FeedAnimation, fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -36,7 +36,9 @@ impl Skeleton for BirdMediumSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(1.0 / 11.0);
|
||||
let torso_mat = base_mat * Mat4::<f32>::from(self.torso);
|
||||
|
||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||
@ -48,7 +50,17 @@ impl Skeleton for BirdMediumSkeleton {
|
||||
make_bone(base_mat * Mat4::<f32>::from(self.leg_l)),
|
||||
make_bone(base_mat * Mat4::<f32>::from(self.leg_r)),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::BirdMedium(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,8 @@ impl Animation for RunAnimation {
|
||||
let center = (anim_time * lab + PI / 2.0).sin();
|
||||
let centeroffset = (anim_time * lab + PI * 1.5).sin();
|
||||
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
next.wing_l.scale = Vec3::one() * 1.05;
|
||||
next.wing_r.scale = Vec3::one() * 1.05;
|
||||
next.leg_l.scale = Vec3::one() / 11.0;
|
||||
next.leg_r.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + center * 0.5);
|
||||
next.head.orientation =
|
||||
@ -44,9 +41,8 @@ impl Animation for RunAnimation {
|
||||
0.0,
|
||||
s_a.chest.0 + centeroffset * 0.6,
|
||||
center * 0.6 + s_a.chest.1,
|
||||
) / 11.0;
|
||||
);
|
||||
next.torso.orientation = Quaternion::rotation_y(center * 0.05);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1 + centeroffset * 0.6);
|
||||
next.tail.orientation = Quaternion::rotation_x(center * 0.03);
|
||||
@ -57,10 +53,10 @@ impl Animation for RunAnimation {
|
||||
next.wing_r.position = Vec3::new(s_a.wing.0, s_a.wing.1, s_a.wing.2);
|
||||
next.wing_r.orientation = Quaternion::rotation_y((footr * 0.35).min(0.0));
|
||||
|
||||
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 + footl * 1.0, s_a.foot.2) / 11.0;
|
||||
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 + footl * 1.0, s_a.foot.2);
|
||||
next.leg_l.orientation = Quaternion::rotation_x(footl * 0.5);
|
||||
|
||||
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + footr * 1.0, s_a.foot.2) / 11.0;
|
||||
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + footr * 1.0, s_a.foot.2);
|
||||
next.leg_r.orientation = Quaternion::rotation_x(footr * 0.5);
|
||||
next
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ impl Animation for AlphaAnimation {
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 1.1);
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
match ability_info.and_then(|a| a.tool) {
|
||||
|
@ -106,7 +106,7 @@ impl Animation for ClimbAnimation {
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(smooth * -0.3) * Quaternion::rotation_y(smooth * -0.3);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, -0.2 + smooth * -0.08, 0.4) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, -2.2 + smooth * -0.88, 4.4);
|
||||
} else {
|
||||
next.head.position = Vec3::new(0.0, -1.0 - stagnant + s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(
|
||||
@ -158,7 +158,7 @@ impl Animation for ClimbAnimation {
|
||||
next.foot_r.orientation =
|
||||
Quaternion::rotation_x(0.2 + smooth * 0.15 * (1.0 - stagnant));
|
||||
|
||||
next.torso.position = Vec3::new(0.0, -0.2, 0.4) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, -2.2, 4.4);
|
||||
};
|
||||
|
||||
next
|
||||
|
@ -104,7 +104,7 @@ impl Animation for DanceAnimation {
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(shorte * 0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, -0.3, 0.0) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, -3.3, 0.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(short * -0.2);
|
||||
|
||||
next
|
||||
|
@ -43,7 +43,6 @@ impl Animation for IdleAnimation {
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
next.shoulder_l.scale = Vec3::one() * 1.1;
|
||||
next.shoulder_r.scale = Vec3::one() * 1.1;
|
||||
|
||||
@ -136,7 +135,7 @@ impl Animation for IdleAnimation {
|
||||
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
||||
next.second.scale = match hands {
|
||||
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
|
||||
|
@ -205,9 +205,8 @@ impl Animation for JumpAnimation {
|
||||
* Quaternion::rotation_y(tilt * 4.0 * slow + tilt * 3.0);
|
||||
}
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.orientation = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match active_tool_kind {
|
||||
|
@ -51,7 +51,7 @@ impl Animation for LeapAnimation {
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 1.1);
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
match ability_info.and_then(|a| a.tool) {
|
||||
|
@ -13,6 +13,7 @@ pub mod gliding;
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod leapmelee;
|
||||
pub mod mount;
|
||||
pub mod repeater;
|
||||
pub mod roll;
|
||||
pub mod run;
|
||||
@ -36,13 +37,14 @@ pub use self::{
|
||||
chargeswing::ChargeswingAnimation, climb::ClimbAnimation, consume::ConsumeAnimation,
|
||||
dance::DanceAnimation, dash::DashAnimation, equip::EquipAnimation,
|
||||
glidewield::GlideWieldAnimation, gliding::GlidingAnimation, idle::IdleAnimation,
|
||||
jump::JumpAnimation, leapmelee::LeapAnimation, repeater::RepeaterAnimation,
|
||||
roll::RollAnimation, run::RunAnimation, shockwave::ShockwaveAnimation, shoot::ShootAnimation,
|
||||
sit::SitAnimation, sneak::SneakAnimation, spin::SpinAnimation, spinmelee::SpinMeleeAnimation,
|
||||
staggered::StaggeredAnimation, stand::StandAnimation, stunned::StunnedAnimation,
|
||||
swim::SwimAnimation, swimwield::SwimWieldAnimation, talk::TalkAnimation, wield::WieldAnimation,
|
||||
jump::JumpAnimation, leapmelee::LeapAnimation, mount::MountAnimation,
|
||||
repeater::RepeaterAnimation, roll::RollAnimation, run::RunAnimation,
|
||||
shockwave::ShockwaveAnimation, shoot::ShootAnimation, sit::SitAnimation, sneak::SneakAnimation,
|
||||
spin::SpinAnimation, spinmelee::SpinMeleeAnimation, staggered::StaggeredAnimation,
|
||||
stand::StandAnimation, stunned::StunnedAnimation, swim::SwimAnimation,
|
||||
swimwield::SwimWieldAnimation, talk::TalkAnimation, wield::WieldAnimation,
|
||||
};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp;
|
||||
use core::{convert::TryFrom, f32::consts::PI};
|
||||
|
||||
@ -96,7 +98,13 @@ impl Skeleton for CharacterSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
// TODO: extract scaler from body to it's own method so we can call that
|
||||
// directly instead of going through SkeletonAttr? (note todo also
|
||||
// appiles to other body variant animations)
|
||||
let base_mat = base_mat * Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 11.0);
|
||||
|
||||
let torso_mat = base_mat * Mat4::<f32>::from(self.torso);
|
||||
let chest_mat = torso_mat * Mat4::<f32>::from(self.chest);
|
||||
let head_mat = chest_mat * Mat4::<f32>::from(self.head);
|
||||
@ -132,7 +140,17 @@ impl Skeleton for CharacterSkeleton {
|
||||
// FIXME: Should this be control_l_mat?
|
||||
make_bone(control_mat * hand_l_mat * Mat4::<f32>::from(self.hold)),
|
||||
];
|
||||
(lantern_mat * Vec4::new(0.0, 0.0, -4.0, 1.0)).xyz()
|
||||
Offsets {
|
||||
lantern: (lantern_mat * Vec4::new(0.0, 0.0, -4.0, 1.0)).xyz(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::Humanoid(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
216
voxygen/anim/src/character/mount.rs
Normal file
216
voxygen/anim/src/character/mount.rs
Normal file
@ -0,0 +1,216 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
|
||||
pub struct MountAnimation;
|
||||
|
||||
impl Animation for MountAnimation {
|
||||
#[allow(clippy::type_complexity)]
|
||||
type Dependency<'a> = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
(Option<Hands>, Option<Hands>),
|
||||
f32,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_mount\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_mount")]
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
hands,
|
||||
global_time,
|
||||
velocity,
|
||||
avg_vel,
|
||||
orientation,
|
||||
last_ori,
|
||||
): Self::Dependency<'a>,
|
||||
anim_time: f32,
|
||||
_rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let slow = (anim_time * 1.0).sin();
|
||||
let slowa = (anim_time * 1.0 + PI / 2.0).sin();
|
||||
let stop = (anim_time * 3.0).min(PI / 2.0).sin();
|
||||
|
||||
let head_look = Vec2::new(
|
||||
(global_time * 0.05 + anim_time / 15.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.25,
|
||||
(global_time * 0.05 + anim_time / 15.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.125,
|
||||
);
|
||||
|
||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
|
||||
let canceler = (speed / 24.0).powf(0.6);
|
||||
let _x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()) * canceler;
|
||||
let _tilt = if ::vek::Vec2::new(ori, last_ori)
|
||||
.map(|o| o.magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
|
||||
next.head.scale = Vec3::one() * s_a.head_scale;
|
||||
next.chest.scale = Vec3::one() * 1.01;
|
||||
next.hand_l.scale = Vec3::one() * 1.04;
|
||||
next.hand_r.scale = Vec3::one() * 1.04;
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
next.shoulder_l.scale = Vec3::one() * 1.1;
|
||||
next.shoulder_r.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * 0.1 + stop * -0.8);
|
||||
next.head.orientation = Quaternion::rotation_z(head_look.x + slow * 0.2 - slow * 0.1)
|
||||
* Quaternion::rotation_x((0.4 + slowa * -0.1 + slow * 0.1 + head_look.y).abs());
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_x(-0.6 + stop * 0.15);
|
||||
|
||||
next.belt.position = Vec3::new(0.0, s_a.belt.0 + stop * 1.2, s_a.belt.1);
|
||||
next.belt.orientation = Quaternion::rotation_x(stop * 0.3);
|
||||
|
||||
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + stop * 2.5, s_a.shorts.1 + stop * 0.6);
|
||||
next.shorts.orientation = Quaternion::rotation_x(stop * 0.6);
|
||||
|
||||
next.hand_l.position = Vec3::new(
|
||||
-s_a.hand.0 + 4.0,
|
||||
s_a.hand.1 + slowa * 0.15 + stop * 8.0,
|
||||
s_a.hand.2 + slow * 0.7 + stop * 4.0,
|
||||
);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(-PI / 2.0);
|
||||
|
||||
next.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 - 4.0,
|
||||
s_a.hand.1 + slowa * 0.15 + stop * 8.0,
|
||||
s_a.hand.2 + slow * 0.7 + stop * 4.0,
|
||||
);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI / 2.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0 - 2.0, 4.0 + s_a.foot.1, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(slow * 0.1 + stop * 0.4 + slow * 0.1)
|
||||
* Quaternion::rotation_y(0.5);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0 + 2.0, 4.0 + s_a.foot.1, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(slowa * 0.1 + stop * 0.4 + slowa * 0.1)
|
||||
* Quaternion::rotation_y(-0.5);
|
||||
|
||||
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, stop * -1.76);
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(
|
||||
s_a.hand.0 + 1.0 - head_look.x * 8.0,
|
||||
s_a.hand.1 + 5.0 + head_look.x * 6.0,
|
||||
s_a.hand.2 + 9.0 + head_look.y * 6.0,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(2.25)
|
||||
* Quaternion::rotation_z(0.9)
|
||||
* Quaternion::rotation_y(head_look.x * 3.0)
|
||||
* Quaternion::rotation_x(head_look.y * 3.0);
|
||||
|
||||
let fast = (anim_time * 5.0).sin();
|
||||
let fast2 = (anim_time * 4.5 + 8.0).sin();
|
||||
|
||||
next.lantern.position = Vec3::new(-0.5, -0.5, -2.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse()
|
||||
* Quaternion::rotation_x(fast * 0.1)
|
||||
* Quaternion::rotation_y(fast2 * 0.1);
|
||||
}
|
||||
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
|
||||
match hands {
|
||||
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => match active_tool_kind {
|
||||
Some(ToolKind::Bow) => {
|
||||
next.main.position = Vec3::new(0.0, -5.0, 6.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
},
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
next.main.position = Vec3::new(2.0, -5.0, -1.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
|
||||
},
|
||||
_ => {
|
||||
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
},
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match active_tool_kind {
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
|
||||
next.main.orientation =
|
||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(1.57);
|
||||
},
|
||||
|
||||
_ => {},
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
match hands {
|
||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
next.second.position = Vec3::new(4.0, -6.0, 10.0);
|
||||
next.second.orientation =
|
||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-1.57);
|
||||
},
|
||||
_ => {},
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
|
||||
next.second.scale = match hands {
|
||||
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
if let (None, Some(Hands::Two)) = hands {
|
||||
next.second = next.main;
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -109,7 +109,7 @@ impl Animation for RollAnimation {
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(0.9 * movement1);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 8.0 * movement1) / 11.0 * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 8.0 * movement1);
|
||||
next.torso.orientation = Quaternion::rotation_x(movement1 * -0.4 + movement2 * -2.0 * PI)
|
||||
* Quaternion::rotation_z(tilt * -10.0);
|
||||
|
||||
|
@ -275,8 +275,7 @@ impl Animation for RunAnimation {
|
||||
* Quaternion::rotation_y(tilt * 4.0 * fast + tilt * 3.0 + fast2 * speednorm * 0.25);
|
||||
}
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match active_tool_kind {
|
||||
|
@ -85,7 +85,7 @@ impl Animation for SitAnimation {
|
||||
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, -0.2, stop * -0.16) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, -2.2, stop * -1.76);
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(
|
||||
|
@ -96,8 +96,9 @@ impl Animation for SpinAnimation {
|
||||
next.torso.position = Vec3::new(
|
||||
0.0,
|
||||
0.0,
|
||||
-1.0 + 1.0 * (movement1 * 0.5 * PI).sin()
|
||||
+ 1.0 * (movement2 * 0.5 * PI + 0.5 * PI).sin(),
|
||||
-11.0
|
||||
+ 11.0 * (movement1 * 0.5 * PI).sin()
|
||||
+ 11.0 * (movement2 * 0.5 * PI + 0.5 * PI).sin(),
|
||||
);
|
||||
next.torso.orientation =
|
||||
Quaternion::rotation_z(movement1.powi(2) * -6.0 + movement2 * -1.7);
|
||||
|
@ -253,7 +253,7 @@ impl Animation for StaggeredAnimation {
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_z(movement1 * 0.6);
|
||||
};
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
if let (None, Some(Hands::Two)) = hands {
|
||||
|
@ -60,7 +60,6 @@ impl Animation for StandAnimation {
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
next.shoulder_l.scale = Vec3::one() * 1.1;
|
||||
next.shoulder_r.scale = Vec3::one() * 1.1;
|
||||
|
||||
@ -178,7 +177,7 @@ impl Animation for StandAnimation {
|
||||
* Quaternion::rotation_y(fast2 * 0.1 + tilt * 3.0);
|
||||
}
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.scale = Vec3::one();
|
||||
next.second.scale = match hands {
|
||||
(Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(),
|
||||
|
@ -213,7 +213,7 @@ impl Animation for StunnedAnimation {
|
||||
next.hand_l.orientation = Quaternion::rotation_x(movement1abs * 1.2)
|
||||
* Quaternion::rotation_y(movement1 * 1.2);
|
||||
};
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
if let (None, Some(Hands::Two)) = hands {
|
||||
|
@ -232,13 +232,12 @@ impl Animation for SwimAnimation {
|
||||
} else {
|
||||
avgtotal
|
||||
};
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 1.0 - avgspeed * 0.05) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 11.0 - avgspeed * 0.55);
|
||||
next.torso.orientation = Quaternion::rotation_x(
|
||||
(((1.0 / switch) * PI / 2.0 + avg_vel.z * 0.12).min(PI / 2.0) - PI / 2.0)
|
||||
+ avgspeed * avg_vel.z * -0.003,
|
||||
) * Quaternion::rotation_y(tilt * 2.0)
|
||||
* Quaternion::rotation_z(tilt * 3.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match active_tool_kind {
|
||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
||||
|
@ -75,9 +75,8 @@ impl Animation for SwimWieldAnimation {
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
if velocity > 0.01 {
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 1.0) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 11.0);
|
||||
next.torso.orientation = Quaternion::rotation_x(velocity * -0.05);
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
|
||||
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
|
||||
next.back.orientation = Quaternion::rotation_x(
|
||||
@ -92,8 +91,7 @@ impl Animation for SwimWieldAnimation {
|
||||
|
||||
next.chest.position =
|
||||
Vec3::new(0.0 + slowalt * 0.5, s_a.chest.0, s_a.chest.1 + u_slow * 0.5);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, -2.0 + s_a.foot.1, s_a.foot.2);
|
||||
|
||||
|
@ -5,7 +5,7 @@ pub mod run;
|
||||
// Reexports
|
||||
pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -43,7 +43,9 @@ impl Skeleton for DragonSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(1.0);
|
||||
let chest_front_mat = base_mat * Mat4::<f32>::from(self.chest_front);
|
||||
let chest_rear_mat = chest_front_mat * Mat4::<f32>::from(self.chest_rear);
|
||||
let head_lower_mat = chest_front_mat * Mat4::<f32>::from(self.head_lower);
|
||||
@ -69,7 +71,17 @@ impl Skeleton for DragonSkeleton {
|
||||
make_bone(chest_rear_mat * Mat4::<f32>::from(self.foot_bl)),
|
||||
make_bone(chest_rear_mat * Mat4::<f32>::from(self.foot_br)),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::Dragon(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,14 +30,13 @@ impl Animation for IdleAnimation {
|
||||
let slowalt = (anim_time * 3.5 + PI + 0.2).sin();
|
||||
|
||||
next.jaw.scale = Vec3::one() * 0.98;
|
||||
next.chest_front.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(slowalt * -0.1);
|
||||
|
||||
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||
|
||||
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1) / 11.0;
|
||||
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1);
|
||||
next.chest_front.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
|
||||
|
@ -4,7 +4,7 @@ pub mod swim;
|
||||
// Reexports
|
||||
pub use self::{idle::IdleAnimation, swim::SwimAnimation};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -33,7 +33,10 @@ impl Skeleton for FishMediumSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(1.0 / 11.0);
|
||||
|
||||
let chest_front_mat = base_mat * Mat4::<f32>::from(self.chest_front);
|
||||
let chest_back_mat = Mat4::<f32>::from(self.chest_back);
|
||||
let head_mat = Mat4::<f32>::from(self.head);
|
||||
@ -47,7 +50,17 @@ impl Skeleton for FishMediumSkeleton {
|
||||
make_bone(chest_front_mat * Mat4::<f32>::from(self.fin_l)),
|
||||
make_bone(chest_front_mat * Mat4::<f32>::from(self.fin_r)),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::FishMedium(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,14 +47,12 @@ impl Animation for SwimAnimation {
|
||||
let vel = (velocity.magnitude()).min(s_a.amplitude);
|
||||
let slowvel = vel * 0.1;
|
||||
|
||||
next.chest_front.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(slowalt * -0.1 + tilt * -2.0);
|
||||
|
||||
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||
|
||||
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1) / 11.0;
|
||||
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1);
|
||||
next.chest_front.orientation = Quaternion::rotation_x(velocity.z.abs() * -0.005 + x_tilt)
|
||||
* Quaternion::rotation_z(fast * vel * -0.02);
|
||||
|
||||
|
@ -28,9 +28,7 @@ impl Animation for IdleAnimation {
|
||||
|
||||
let slow = (anim_time * 3.5 + PI).sin();
|
||||
|
||||
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.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
|
||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||
next.tail.orientation = Quaternion::rotation_z(slow * 0.1);
|
||||
|
@ -4,7 +4,7 @@ pub mod swim;
|
||||
// Reexports
|
||||
pub use self::{idle::IdleAnimation, swim::SwimAnimation};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -30,7 +30,9 @@ impl Skeleton for FishSmallSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(1.0 / 13.0);
|
||||
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
|
||||
|
||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||
@ -39,7 +41,17 @@ impl Skeleton for FishSmallSkeleton {
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.fin_l)),
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.fin_r)),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::FishSmall(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,9 +45,7 @@ impl Animation for SwimAnimation {
|
||||
let vel = (velocity.magnitude()).min(s_a.amplitude);
|
||||
let slowvel = vel * 0.1;
|
||||
|
||||
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.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_x(velocity.z.abs() * -0.005 + x_tilt)
|
||||
* Quaternion::rotation_z(fast * -0.1);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
|
||||
pub type Body = ();
|
||||
|
||||
@ -31,9 +31,13 @@ impl Skeleton for FixtureSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
(): Self::Body,
|
||||
) -> Offsets {
|
||||
buf[0] = make_bone(base_mat);
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
mount_bone: Transform::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ impl Animation for AlphaAnimation {
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_y(0.0) * Quaternion::rotation_x(move1 * -1.0 + move2 * 1.8);
|
||||
};
|
||||
next.torso.position = Vec3::new(0.0, move1 * 0.7, move1 * -0.3);
|
||||
next.torso.position = Vec3::new(0.0, move1 * 3.7, move1 * -1.6);
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ impl Animation for IdleAnimation {
|
||||
);
|
||||
next.head.scale = Vec3::one() * 1.02;
|
||||
next.jaw.scale = Vec3::one() * 1.02;
|
||||
next.upper_torso.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
next.hand_l.scale = Vec3::one() * 1.04;
|
||||
next.hand_r.scale = Vec3::one() * 1.04;
|
||||
next.leg_l.scale = Vec3::one() * 1.02;
|
||||
@ -56,7 +55,7 @@ impl Animation for IdleAnimation {
|
||||
next.jaw.orientation = Quaternion::rotation_x(-0.1 + breathe * 0.1);
|
||||
|
||||
next.upper_torso.position =
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5) * s_a.scaler / 8.0;
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5);
|
||||
|
||||
next.lower_torso.position =
|
||||
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + breathe * -0.2);
|
||||
|
@ -12,7 +12,7 @@ pub use self::{
|
||||
shockwave::ShockwaveAnimation, shoot::ShootAnimation, spinmelee::SpinMeleeAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -47,7 +47,10 @@ impl Skeleton for GolemSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 8.0);
|
||||
|
||||
let torso_mat = base_mat * Mat4::<f32>::from(self.torso);
|
||||
let upper_torso_mat = torso_mat * Mat4::<f32>::from(self.upper_torso);
|
||||
let lower_torso_mat = upper_torso_mat * Mat4::<f32>::from(self.lower_torso);
|
||||
@ -70,7 +73,17 @@ impl Skeleton for GolemSkeleton {
|
||||
make_bone(leg_l_mat * Mat4::<f32>::from(self.foot_l)),
|
||||
make_bone(leg_r_mat * Mat4::<f32>::from(self.foot_r)),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::Golem(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,6 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.head.scale = Vec3::one() * 1.02;
|
||||
next.jaw.scale = Vec3::one() * 1.02;
|
||||
next.upper_torso.scale = Vec3::one() * s_a.scaler / 8.0;
|
||||
next.hand_l.scale = Vec3::one() * 1.04;
|
||||
next.hand_r.scale = Vec3::one() * 1.04;
|
||||
next.leg_l.scale = Vec3::one() * 1.02;
|
||||
@ -80,7 +79,7 @@ impl Animation for RunAnimation {
|
||||
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1) * 1.02;
|
||||
|
||||
next.upper_torso.position =
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + short * 1.0) * s_a.scaler / 8.0;
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + short * 1.0);
|
||||
next.upper_torso.orientation = Quaternion::rotation_z(tilt * -4.0 + short * 0.40);
|
||||
|
||||
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
|
||||
|
@ -40,7 +40,7 @@ impl Animation for ShockwaveAnimation {
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -PI);
|
||||
|
||||
next.upper_torso.position =
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + move2 * -5.0) * s_a.scaler / 8.0;
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + move2 * -5.0);
|
||||
next.upper_torso.orientation = Quaternion::rotation_z(move1 * -PI);
|
||||
|
||||
next.lower_torso.position =
|
||||
|
@ -37,8 +37,7 @@ impl Animation for SpinMeleeAnimation {
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_z(movement2 * -2.0 * PI) * Quaternion::rotation_x(-0.2);
|
||||
|
||||
next.upper_torso.position =
|
||||
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1) * s_a.scaler / 8.0;
|
||||
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
|
||||
next.upper_torso.orientation = Quaternion::rotation_z(movement2 * 2.0 * PI);
|
||||
|
||||
next.lower_torso.position =
|
||||
|
@ -98,6 +98,12 @@ lazy_static! {
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
pub fn init() { lazy_static::initialize(&LIB); }
|
||||
|
||||
// Offsets that will be returned after computing the skeleton matrices
|
||||
pub struct Offsets {
|
||||
pub lantern: Vec3<f32>,
|
||||
pub mount_bone: Transform<f32, f32, f32>,
|
||||
}
|
||||
|
||||
pub trait Skeleton: Send + Sync + 'static {
|
||||
type Attr;
|
||||
type Body;
|
||||
@ -111,17 +117,19 @@ pub trait Skeleton: Send + Sync + 'static {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; MAX_BONE_COUNT],
|
||||
) -> Vec3<f32>;
|
||||
body: Self::Body,
|
||||
) -> Offsets;
|
||||
}
|
||||
|
||||
pub fn compute_matrices<S: Skeleton>(
|
||||
skeleton: &S,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: S::Body,
|
||||
) -> Offsets {
|
||||
#[cfg(not(feature = "use-dyn-lib"))]
|
||||
{
|
||||
S::compute_matrices_inner(skeleton, base_mat, buf)
|
||||
S::compute_matrices_inner(skeleton, base_mat, buf, body)
|
||||
}
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
{
|
||||
@ -130,7 +138,7 @@ pub fn compute_matrices<S: Skeleton>(
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
let compute_fn: voxygen_dynlib::Symbol<
|
||||
fn(&S, Mat4<f32>, &mut [FigureBoneData; MAX_BONE_COUNT]) -> Vec3<f32>,
|
||||
fn(&S, Mat4<f32>, &mut [FigureBoneData; MAX_BONE_COUNT], S::Body) -> Offsets,
|
||||
> = unsafe { lib.get(S::COMPUTE_FN) }.unwrap_or_else(|e| {
|
||||
panic!(
|
||||
"Trying to use: {} but had error: {:?}",
|
||||
@ -142,7 +150,7 @@ pub fn compute_matrices<S: Skeleton>(
|
||||
)
|
||||
});
|
||||
|
||||
compute_fn(skeleton, base_mat, buf)
|
||||
compute_fn(skeleton, base_mat, buf, body)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,10 +33,10 @@ impl Animation for BeamAnimation {
|
||||
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2) / 11.0;
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2);
|
||||
next.bone0.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2) / 11.0;
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2);
|
||||
next.bone1.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
next
|
||||
|
@ -23,9 +23,9 @@ impl Animation for IdleAnimation {
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2) / 11.0;
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2);
|
||||
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2) / 11.0;
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2);
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ pub mod shoot;
|
||||
// Reexports
|
||||
pub use self::{beam::BeamAnimation, idle::IdleAnimation, shoot::ShootAnimation};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -29,14 +29,27 @@ impl Skeleton for ObjectSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
let bone0_mat = base_mat * Mat4::<f32>::from(self.bone0);
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let scale_mat = Mat4::scaling_3d(1.0 / 11.0);
|
||||
|
||||
let bone0_mat = base_mat * scale_mat * Mat4::<f32>::from(self.bone0);
|
||||
|
||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||
make_bone(bone0_mat * Mat4::scaling_3d(1.0 / 11.0)),
|
||||
make_bone(Mat4::<f32>::from(self.bone1) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */
|
||||
make_bone(bone0_mat),
|
||||
make_bone(scale_mat * Mat4::<f32>::from(self.bone1)), /* Decorellated from ori */
|
||||
];
|
||||
Vec3::unit_z() * 0.5
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::Object(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,17 +40,17 @@ impl Animation for ShootAnimation {
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2) / 11.0;
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2) / 11.0;
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2);
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2);
|
||||
|
||||
#[allow(clippy::single_match)]
|
||||
match body {
|
||||
Body::Crossbow => {
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2) / 11.0;
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2);
|
||||
next.bone0.orientation =
|
||||
Quaternion::rotation_x(movement1 * 0.05 + movement2 * 0.1) * (1.0 - movement3);
|
||||
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2) / 11.0;
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2);
|
||||
next.bone1.orientation = Quaternion::rotation_z(0.0);
|
||||
},
|
||||
_ => {},
|
||||
|
@ -40,7 +40,6 @@ impl Animation for IdleAnimation {
|
||||
* 0.1,
|
||||
);
|
||||
next.jaw.scale = Vec3::one() * 0.98;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.tail_front.scale = Vec3::one() * 0.98;
|
||||
next.tail_rear.scale = Vec3::one() * 0.98;
|
||||
|
||||
@ -57,7 +56,7 @@ impl Animation for IdleAnimation {
|
||||
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05 - 0.05);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_y(slow * 0.03);
|
||||
|
||||
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
|
||||
|
@ -23,7 +23,6 @@ impl Animation for JumpAnimation {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.jaw.scale = Vec3::one() * 0.98;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.tail_front.scale = Vec3::one() * 0.98;
|
||||
next.tail_rear.scale = Vec3::one() * 0.98;
|
||||
|
||||
@ -33,7 +32,7 @@ impl Animation for JumpAnimation {
|
||||
|
||||
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
|
||||
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
|
||||
|
||||
|
@ -16,7 +16,7 @@ pub use self::{
|
||||
stunned::StunnedAnimation, tailwhip::TailwhipAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -48,7 +48,10 @@ impl Skeleton for QuadrupedLowSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 11.0);
|
||||
|
||||
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
|
||||
let tail_front = chest_mat * Mat4::<f32>::from(self.tail_front);
|
||||
let head_lower_mat = chest_mat * Mat4::<f32>::from(self.head_lower);
|
||||
@ -66,7 +69,17 @@ impl Skeleton for QuadrupedLowSkeleton {
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.foot_bl)),
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.foot_br)),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::QuadrupedLow(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,6 @@ impl Animation for RunAnimation {
|
||||
} * 1.3;
|
||||
|
||||
next.jaw.scale = Vec3::one() * 0.98;
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.tail_front.scale = Vec3::one() * 0.98;
|
||||
next.tail_rear.scale = Vec3::one() * 0.98;
|
||||
|
||||
@ -107,7 +106,7 @@ impl Animation for RunAnimation {
|
||||
* Quaternion::rotation_y(shortalt * 0.08)
|
||||
* Quaternion::rotation_x(-0.04 + x_tilt * 0.5);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_z(short * 0.13 + tilt * -1.9)
|
||||
* Quaternion::rotation_y(short * 0.12 + tilt * 0.7)
|
||||
* Quaternion::rotation_x(x_tilt + s_a.lean.0);
|
||||
|
@ -44,7 +44,7 @@ impl Animation for ShootAnimation {
|
||||
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||
next.jaw.orientation = Quaternion::rotation_x(movement1 * -0.5);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
|
||||
|
@ -59,8 +59,7 @@ impl Animation for AlphaAnimation {
|
||||
0.0,
|
||||
s_a.torso_front.0 + movement1abs * -4.0,
|
||||
s_a.torso_front.1,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.torso_front.orientation = Quaternion::rotation_y(movement1 * -0.25 * movement2 * 0.25)
|
||||
* Quaternion::rotation_z(movement1 * 0.35 + movement2 * -0.45);
|
||||
|
||||
|
@ -59,8 +59,7 @@ impl Animation for BetaAnimation {
|
||||
0.0,
|
||||
s_a.torso_front.0 + movement1abs * -4.0,
|
||||
s_a.torso_front.1,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.torso_front.orientation = Quaternion::rotation_y(movement1 * -0.25 * movement2 * 0.25)
|
||||
* Quaternion::rotation_z(movement1 * 0.35 + movement2 * -0.45);
|
||||
|
||||
|
@ -79,8 +79,7 @@ impl Animation for FeedAnimation {
|
||||
0.0,
|
||||
s_a.torso_front.0,
|
||||
s_a.torso_front.1 + slower * 0.3 + transition * -6.0,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.torso_front.orientation =
|
||||
Quaternion::rotation_x(transition * -0.7) * Quaternion::rotation_y(slow * 0.02);
|
||||
|
||||
|
@ -57,8 +57,7 @@ impl Animation for HoofAnimation {
|
||||
0.0,
|
||||
s_a.torso_front.0 + movement1abs * -6.0,
|
||||
s_a.torso_front.1 + movement1abs * 9.0,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.torso_front.orientation = Quaternion::rotation_x(movement1abs * 1.2);
|
||||
|
||||
next.torso_back.orientation = Quaternion::rotation_x(movement1abs * -0.8);
|
||||
|
@ -53,7 +53,6 @@ impl Animation for IdleAnimation {
|
||||
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.jaw.scale = Vec3::one() * 1.02;
|
||||
next.torso_front.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.leg_fl.scale = Vec3::one() * 1.02;
|
||||
next.leg_fr.scale = Vec3::one() * 1.02;
|
||||
next.leg_bl.scale = Vec3::one() * 1.02;
|
||||
@ -79,7 +78,7 @@ impl Animation for IdleAnimation {
|
||||
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0);
|
||||
|
||||
next.torso_front.position =
|
||||
Vec3::new(0.0, s_a.torso_front.0, s_a.torso_front.1 + slower * 0.3) * s_a.scaler / 11.0;
|
||||
Vec3::new(0.0, s_a.torso_front.0, s_a.torso_front.1 + slower * 0.3);
|
||||
next.torso_front.orientation = Quaternion::rotation_y(slow * 0.02);
|
||||
|
||||
next.torso_back.position =
|
||||
|
@ -24,7 +24,6 @@ impl Animation for JumpAnimation {
|
||||
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.jaw.scale = Vec3::one() * 1.02;
|
||||
next.torso_front.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.leg_fl.scale = Vec3::one() * 1.02;
|
||||
next.leg_fr.scale = Vec3::one() * 1.02;
|
||||
next.leg_bl.scale = Vec3::one() * 1.02;
|
||||
@ -44,8 +43,7 @@ impl Animation for JumpAnimation {
|
||||
|
||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||
|
||||
next.torso_front.position =
|
||||
Vec3::new(0.0, s_a.torso_front.0, s_a.torso_front.1) * s_a.scaler / 11.0;
|
||||
next.torso_front.position = Vec3::new(0.0, s_a.torso_front.0, s_a.torso_front.1);
|
||||
next.torso_front.orientation = Quaternion::rotation_y(0.0);
|
||||
|
||||
next.torso_back.position = Vec3::new(0.0, s_a.torso_back.0, s_a.torso_back.1);
|
||||
|
@ -56,8 +56,7 @@ impl Animation for LeapMeleeAnimation {
|
||||
0.0,
|
||||
s_a.torso_front.0 + movement1abs * -4.0,
|
||||
s_a.torso_front.1,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.torso_front.orientation =
|
||||
Quaternion::rotation_x(movement1abs * 0.3 + movement2abs * -0.3 + movement3abs * 0.3)
|
||||
* Quaternion::rotation_y(twitch1abs * -0.1);
|
||||
|
@ -16,7 +16,7 @@ pub use self::{
|
||||
run::RunAnimation, stunned::StunnedAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -38,6 +38,7 @@ skeleton_impls!(struct QuadrupedMediumSkeleton {
|
||||
+ foot_fr,
|
||||
+ foot_bl,
|
||||
+ foot_br,
|
||||
mount,
|
||||
});
|
||||
|
||||
impl Skeleton for QuadrupedMediumSkeleton {
|
||||
@ -53,7 +54,10 @@ impl Skeleton for QuadrupedMediumSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let base_mat = base_mat * Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 11.0);
|
||||
|
||||
let torso_front_mat = base_mat * Mat4::<f32>::from(self.torso_front);
|
||||
let torso_back_mat = torso_front_mat * Mat4::<f32>::from(self.torso_back);
|
||||
let neck_mat = torso_front_mat * Mat4::<f32>::from(self.neck);
|
||||
@ -80,7 +84,32 @@ impl Skeleton for QuadrupedMediumSkeleton {
|
||||
make_bone(leg_bl_mat * Mat4::<f32>::from(self.foot_bl)),
|
||||
make_bone(leg_br_mat * Mat4::<f32>::from(self.foot_br)),
|
||||
];
|
||||
Vec3::default()
|
||||
|
||||
use comp::quadruped_medium::Species::*;
|
||||
let (mount_bone_mat, mount_bone_ori) = match (body.species, body.body_type) {
|
||||
(Mammoth, _) => (
|
||||
head_mat,
|
||||
self.torso_front.orientation * self.neck.orientation * self.head.orientation,
|
||||
),
|
||||
_ => (torso_front_mat, self.torso_front.orientation),
|
||||
};
|
||||
// Offset from the mounted bone's origin.
|
||||
// Note: This could be its own bone if we need to animate it independently.
|
||||
let mount_position = (mount_bone_mat * Vec4::from_point(mount_point(&body)))
|
||||
.homogenized()
|
||||
.xyz();
|
||||
// NOTE: We apply the ori from base_mat externally so we don't need to worry
|
||||
// about it here for now.
|
||||
let mount_orientation = mount_bone_ori;
|
||||
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
mount_bone: Transform {
|
||||
position: mount_position,
|
||||
orientation: mount_orientation,
|
||||
scale: Vec3::one(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +181,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Frostfang, _) => (1.0, -2.0),
|
||||
(Mouflon, _) => (0.5, 1.5),
|
||||
(Catoblepas, _) => (-1.0, -6.5),
|
||||
(Bonerattler, _) => (1.0, 2.5),
|
||||
(Bonerattler, _) => (0.0, 1.5),
|
||||
(Deer, Male) => (1.5, 3.5),
|
||||
(Deer, Female) => (1.5, 3.5),
|
||||
(Hirdrasil, _) => (0.0, 5.0),
|
||||
@ -191,7 +220,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Frostfang, _) => (0.5, 1.5),
|
||||
(Mouflon, _) => (-1.0, 1.0),
|
||||
(Catoblepas, _) => (19.5, -2.0),
|
||||
(Bonerattler, _) => (9.0, -0.5),
|
||||
(Bonerattler, _) => (7.0, -0.5),
|
||||
(Deer, _) => (-2.5, 1.0),
|
||||
(Hirdrasil, _) => (-1.0, 0.5),
|
||||
(Roshwalr, _) => (0.0, 1.0),
|
||||
@ -303,7 +332,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Frostfang, _) => (9.0, 11.5),
|
||||
(Mouflon, _) => (11.0, 14.0),
|
||||
(Catoblepas, _) => (7.5, 19.5),
|
||||
(Bonerattler, _) => (6.0, 12.5),
|
||||
(Bonerattler, _) => (6.0, 11.0),
|
||||
(Deer, _) => (11.0, 13.5),
|
||||
(Hirdrasil, _) => (11.0, 14.5),
|
||||
(Roshwalr, _) => (6.0, 12.5),
|
||||
@ -415,7 +444,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Frostfang, _) => (5.5, -5.5, -2.0),
|
||||
(Mouflon, _) => (4.0, -5.0, -4.0),
|
||||
(Catoblepas, _) => (7.0, 2.0, -5.0),
|
||||
(Bonerattler, _) => (5.5, 5.0, -4.0),
|
||||
(Bonerattler, _) => (5.5, 5.0, -2.5),
|
||||
(Deer, _) => (3.5, -4.5, -3.5),
|
||||
(Hirdrasil, _) => (4.5, -5.0, -2.5),
|
||||
(Roshwalr, _) => (8.0, -2.5, -2.5),
|
||||
@ -452,7 +481,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Frostfang, _) => (3.5, -4.5, -2.0),
|
||||
(Mouflon, _) => (3.5, -8.0, -3.5),
|
||||
(Catoblepas, _) => (6.0, -2.5, -2.5),
|
||||
(Bonerattler, _) => (6.0, -8.0, -4.0),
|
||||
(Bonerattler, _) => (6.0, -8.0, -2.5),
|
||||
(Deer, _) => (3.0, -6.5, -3.5),
|
||||
(Hirdrasil, _) => (4.0, -6.5, -3.0),
|
||||
(Roshwalr, _) => (7.0, -7.0, -2.5),
|
||||
@ -655,3 +684,45 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn mount_point(body: &Body) -> Vec3<f32> {
|
||||
use comp::quadruped_medium::{BodyType::*, Species::*};
|
||||
match (body.species, body.body_type) {
|
||||
(Grolgar, _) => (0.0, -6.0, 6.0),
|
||||
(Saber, _) => (0.0, -12.0, 4.0),
|
||||
(Tuskram, _) => (0.0, -17.0, 2.0),
|
||||
(Lion, _) => (0.0, -8.0, 4.0),
|
||||
(Tarasque, _) => (0.0, -6.0, 4.0),
|
||||
(Tiger, _) => (0.0, -8.0, 4.0),
|
||||
(Wolf, _) => (0.0, -7.0, 3.0),
|
||||
(Frostfang, _) => (0.0, -3.0, 4.0),
|
||||
(Mouflon, _) => (0.0, -8.0, 2.0),
|
||||
(Catoblepas, _) => (0.0, -8.0, 2.0),
|
||||
(Bonerattler, _) => (0.0, -1.0, 4.0),
|
||||
(Deer, _) => (0.0, -9.0, 3.0),
|
||||
(Hirdrasil, _) => (0.0, -11.0, 3.0),
|
||||
(Roshwalr, _) => (0.0, -1.0, 7.0),
|
||||
(Donkey, _) => (0.0, -5.0, 2.0),
|
||||
(Camel, _) => (0.0, -13.0, 5.0),
|
||||
(Zebra, _) => (0.0, -6.0, 3.0),
|
||||
(Antelope, _) => (0.0, -8.0, 3.0),
|
||||
(Kelpie, _) => (0.0, -6.0, 3.0),
|
||||
(Horse, _) => (0.0, -8.0, 3.0),
|
||||
(Barghest, _) => (0.0, -8.0, 5.0),
|
||||
(Cattle, Male) => (0.0, -3.0, 8.0),
|
||||
(Cattle, Female) => (0.0, -2.0, 6.0),
|
||||
(Darkhound, _) => (0.0, -2.0, 3.0),
|
||||
(Highland, _) => (0.0, -3.0, 8.0),
|
||||
(Yak, _) => (0.0, -8.0, 9.0),
|
||||
(Panda, _) => (0.0, -10.0, 5.0),
|
||||
(Bear, _) => (0.0, -11.0, 6.0),
|
||||
(Dreadhorn, _) => (0.0, 0.0, 10.0),
|
||||
(Moose, _) => (0.0, -9.0, 6.0),
|
||||
(Snowleopard, _) => (0.0, -9.0, 4.0),
|
||||
(Mammoth, _) => (0.0, 5.0, 8.0),
|
||||
(Ngoubou, _) => (0.0, -7.0, 6.0),
|
||||
(Llama, _) => (0.0, -6.0, 5.0),
|
||||
(Alpaca, _) => (0.0, -9.0, 3.0),
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.neck.scale = Vec3::one() * 1.02;
|
||||
next.jaw.scale = Vec3::one() * 1.02;
|
||||
next.torso_front.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
next.leg_fl.scale = Vec3::one() * 1.02;
|
||||
next.leg_fr.scale = Vec3::one() * 1.02;
|
||||
next.leg_bl.scale = Vec3::one() * 1.02;
|
||||
@ -129,8 +128,7 @@ impl Animation for RunAnimation {
|
||||
+ canceler * 1.0
|
||||
+ canceler * shortalt * 2.5 * s_a.spring
|
||||
+ x_tilt * 10.0 * canceler,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.torso_front.orientation = Quaternion::rotation_x(
|
||||
((amplitude * (short * -0.13).max(-0.2)) * s_a.spring).min(0.1)
|
||||
+ x_tilt * (canceler * 6.0).min(1.0),
|
||||
|
@ -52,8 +52,7 @@ impl Animation for StunnedAnimation {
|
||||
0.0,
|
||||
s_a.torso_front.0 + movement1abs * -4.0,
|
||||
s_a.torso_front.1,
|
||||
) * s_a.scaler
|
||||
/ 11.0;
|
||||
);
|
||||
next.torso_front.orientation =
|
||||
Quaternion::rotation_y(0.0) * Quaternion::rotation_z(movement1 * 0.15);
|
||||
|
||||
|
@ -40,13 +40,12 @@ impl Animation for FeedAnimation {
|
||||
.sin()
|
||||
* 0.5,
|
||||
);
|
||||
next.chest.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0 + 1.5, s_a.head.1 + slow * 0.2);
|
||||
next.head.orientation = Quaternion::rotation_z(head_look.y)
|
||||
* Quaternion::rotation_x(slow * 0.05 + quick * 0.08 - 0.4 * s_a.feed);
|
||||
|
||||
next.chest.position = Vec3::new(slow * 0.02, s_a.chest.0, s_a.chest.1) / 11.0 * s_a.scaler;
|
||||
next.chest.position = Vec3::new(slow * 0.02, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(-0.35 * s_a.feed) * Quaternion::rotation_y(head_look.y * 0.1);
|
||||
|
||||
|
@ -44,9 +44,8 @@ impl Animation for IdleAnimation {
|
||||
next.head.orientation = Quaternion::rotation_z(head_look.x)
|
||||
* Quaternion::rotation_x(head_look.y + slow_alt * 0.03);
|
||||
|
||||
next.chest.position = Vec3::new(slow * 0.05, s_a.chest.0, s_a.chest.1) / 11.0 * s_a.scaler;
|
||||
next.chest.position = Vec3::new(slow * 0.05, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_y(slow * 0.05);
|
||||
next.chest.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
|
||||
next.leg_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2 + slow * -0.2);
|
||||
next.leg_fl.orientation =
|
||||
|
@ -24,9 +24,8 @@ impl Animation for JumpAnimation {
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_y(0.0);
|
||||
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
|
||||
|
||||
next.leg_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
|
||||
next.leg_fl.orientation = Quaternion::rotation_x(0.0);
|
||||
|
@ -11,7 +11,7 @@ pub use self::{
|
||||
run::RunAnimation, stunned::StunnedAnimation,
|
||||
};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -40,8 +40,11 @@ impl Skeleton for QuadrupedSmallSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let chest_mat = base_mat
|
||||
* Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 11.0)
|
||||
* Mat4::<f32>::from(self.chest);
|
||||
|
||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.head)),
|
||||
@ -52,7 +55,17 @@ impl Skeleton for QuadrupedSmallSkeleton {
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.leg_br)),
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.tail)),
|
||||
];
|
||||
Vec3::default()
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::QuadrupedSmall(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,13 +70,11 @@ impl Animation for RunAnimation {
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + 2.0 * speednorm * s_a.spring + shortalt * 3.0 * s_a.spring,
|
||||
) / 11.0
|
||||
* s_a.scaler;
|
||||
);
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(vertcancel * short * 0.2 * s_a.spring + x_tilt)
|
||||
* Quaternion::rotation_y(tilt * 0.8)
|
||||
* Quaternion::rotation_z(s_a.lateral * short * 0.2 + tilt * -1.5);
|
||||
next.chest.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
|
||||
next.leg_fl.position = Vec3::new(
|
||||
-s_a.feet_f.0,
|
||||
|
@ -39,8 +39,7 @@ impl Animation for StunnedAnimation {
|
||||
let movement1abs = movement1base * pullback;
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1abs * -1.5) / 11.0 * s_a.scaler;
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1abs * -1.5);
|
||||
next.head.orientation = Quaternion::rotation_x(movement1abs * -0.2)
|
||||
* Quaternion::rotation_y(movement1 * -0.6)
|
||||
* Quaternion::rotation_z(movement1 * 0.4 + twitch * 0.2 * mirror);
|
||||
|
@ -42,15 +42,15 @@ impl Animation for IdleAnimation {
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2) / 11.0;
|
||||
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2);
|
||||
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2) / 11.0;
|
||||
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2);
|
||||
next.bone1.orientation = Quaternion::rotation_y(acc_vel * 0.8);
|
||||
|
||||
next.bone2.position = Vec3::new(s_a.bone2.0, s_a.bone2.1, s_a.bone2.2) / 11.0;
|
||||
next.bone2.position = Vec3::new(s_a.bone2.0, s_a.bone2.1, s_a.bone2.2);
|
||||
next.bone2.orientation = Quaternion::rotation_y(-acc_vel * 0.8);
|
||||
|
||||
next.bone3.position = Vec3::new(s_a.bone3.0, s_a.bone3.1, s_a.bone3.2) / 11.0;
|
||||
next.bone3.position = Vec3::new(s_a.bone3.0, s_a.bone3.1, s_a.bone3.2);
|
||||
next.bone3.orientation = Quaternion::rotation_z(tilt * 25.0);
|
||||
next
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ pub mod idle;
|
||||
// Reexports
|
||||
pub use self::idle::IdleAnimation;
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton};
|
||||
use common::comp::{self};
|
||||
use core::convert::TryFrom;
|
||||
|
||||
@ -29,16 +29,27 @@ impl Skeleton for ShipSkeleton {
|
||||
&self,
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
let bone0_mat = base_mat * Mat4::<f32>::from(self.bone0);
|
||||
body: Self::Body,
|
||||
) -> Offsets {
|
||||
let bone0_mat = base_mat * Mat4::scaling_3d(1.0 / 11.0) * Mat4::<f32>::from(self.bone0);
|
||||
|
||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||
make_bone(bone0_mat * Mat4::scaling_3d(1.0 / 11.0)),
|
||||
make_bone(bone0_mat * Mat4::<f32>::from(self.bone1) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */
|
||||
make_bone(bone0_mat * Mat4::<f32>::from(self.bone2) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */
|
||||
make_bone(bone0_mat * Mat4::<f32>::from(self.bone3) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */
|
||||
make_bone(bone0_mat),
|
||||
make_bone(bone0_mat * Mat4::<f32>::from(self.bone1)),
|
||||
make_bone(bone0_mat * Mat4::<f32>::from(self.bone2)),
|
||||
make_bone(bone0_mat * Mat4::<f32>::from(self.bone3)),
|
||||
];
|
||||
Vec3::unit_z() * 0.5
|
||||
Offsets {
|
||||
lantern: Vec3::default(),
|
||||
// TODO: see quadruped_medium for how to animate this
|
||||
mount_bone: Transform {
|
||||
position: common::comp::Body::Ship(body)
|
||||
.mountee_offset()
|
||||
.into_tuple()
|
||||
.into(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,6 @@ impl Animation for IdleAnimation {
|
||||
next.hand_r.scale = Vec3::one() * 0.98;
|
||||
next.tail_front.scale = Vec3::one() * 1.02;
|
||||
next.tail_back.scale = Vec3::one() * 0.98;
|
||||
next.chest_front.scale = Vec3::one() / s_a.scaler;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.3);
|
||||
next.head.orientation = Quaternion::rotation_x(head_look.y + breathe * 0.1 - 0.1)
|
||||
@ -60,7 +59,7 @@ impl Animation for IdleAnimation {
|
||||
next.neck.orientation = Quaternion::rotation_x(-0.1);
|
||||
|
||||
next.chest_front.position =
|
||||
Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1 + breathe * 0.3) / s_a.scaler;
|
||||
Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1 + breathe * 0.3);
|
||||
next.chest_front.orientation = Quaternion::rotation_x(breathe * 0.04);
|
||||
|
||||
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
|
||||
|
@ -26,7 +26,6 @@ impl Animation for JumpAnimation {
|
||||
next.jaw.scale = Vec3::one() * 0.98;
|
||||
next.foot_l.scale = Vec3::one() * 0.96;
|
||||
next.foot_r.scale = Vec3::one() * 0.96;
|
||||
next.chest_front.scale = Vec3::one() / s_a.scaler;
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(-0.1);
|
||||
@ -36,8 +35,7 @@ impl Animation for JumpAnimation {
|
||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
|
||||
next.neck.orientation = Quaternion::rotation_x(-0.1);
|
||||
|
||||
next.chest_front.position =
|
||||
Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1) / s_a.scaler;
|
||||
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1);
|
||||
|
||||
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user