mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
46 lines
1.5 KiB
Rust
46 lines
1.5 KiB
Rust
use super::{
|
|
super::{vek::*, Animation},
|
|
QuadrupedSmallSkeleton, SkeletonAttr,
|
|
};
|
|
|
|
pub struct JumpAnimation;
|
|
|
|
impl Animation for JumpAnimation {
|
|
type Dependency<'a> = (f32, f32);
|
|
type Skeleton = QuadrupedSmallSkeleton;
|
|
|
|
#[cfg(feature = "use-dyn-lib")]
|
|
const UPDATE_FN: &'static [u8] = b"quadruped_small_jump\0";
|
|
|
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_small_jump")]
|
|
fn update_skeleton_inner<'a>(
|
|
skeleton: &Self::Skeleton,
|
|
(_velocity, _global_time): Self::Dependency<'a>,
|
|
_anim_time: f32,
|
|
_rate: &mut f32,
|
|
s_a: &SkeletonAttr,
|
|
) -> Self::Skeleton {
|
|
let mut next = (*skeleton).clone();
|
|
|
|
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);
|
|
next.chest.orientation = Quaternion::rotation_y(0.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);
|
|
|
|
next.leg_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
|
|
next.leg_fr.orientation = Quaternion::rotation_x(0.0);
|
|
|
|
next.leg_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
|
|
next.leg_bl.orientation = Quaternion::rotation_x(0.0);
|
|
|
|
next.leg_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
|
|
next.leg_br.orientation = Quaternion::rotation_x(0.0);
|
|
|
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
|
next
|
|
}
|
|
}
|