veloren_voxygen_anim/quadruped_small/
jump.rs

1use super::{
2    super::{Animation, vek::*},
3    QuadrupedSmallSkeleton, SkeletonAttr,
4};
5
6pub struct JumpAnimation;
7
8impl Animation for JumpAnimation {
9    type Dependency<'a> = (f32, f32);
10    type Skeleton = QuadrupedSmallSkeleton;
11
12    #[cfg(feature = "use-dyn-lib")]
13    const UPDATE_FN: &'static [u8] = b"quadruped_small_jump\0";
14
15    #[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_small_jump")]
16    fn update_skeleton_inner(
17        skeleton: &Self::Skeleton,
18        (_velocity, _global_time): Self::Dependency<'_>,
19        _anim_time: f32,
20        _rate: &mut f32,
21        s_a: &SkeletonAttr,
22    ) -> Self::Skeleton {
23        let mut next = (*skeleton).clone();
24
25        next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
26
27        next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
28        next.chest.orientation = Quaternion::rotation_y(0.0);
29
30        next.leg_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
31        next.leg_fl.orientation = Quaternion::rotation_x(0.0);
32
33        next.leg_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
34        next.leg_fr.orientation = Quaternion::rotation_x(0.0);
35
36        next.leg_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
37        next.leg_bl.orientation = Quaternion::rotation_x(0.0);
38
39        next.leg_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
40        next.leg_br.orientation = Quaternion::rotation_x(0.0);
41
42        next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
43        next
44    }
45}