veloren_voxygen_anim/character/
glidewield.rs

1use super::{
2    super::{Animation, vek::*},
3    CharacterSkeleton, SkeletonAttr,
4};
5
6pub struct GlideWieldAnimation;
7
8type GlideWieldAnimationDependency = (Quaternion<f32>, Quaternion<f32>);
9impl Animation for GlideWieldAnimation {
10    type Dependency<'a> = GlideWieldAnimationDependency;
11    type Skeleton = CharacterSkeleton;
12
13    #[cfg(feature = "use-dyn-lib")]
14    const UPDATE_FN: &'static [u8] = b"character_glidewield\0";
15
16    #[cfg_attr(feature = "be-dyn-lib", export_name = "character_glidewield")]
17
18    fn update_skeleton_inner(
19        skeleton: &Self::Skeleton,
20        (orientation, glider_orientation): Self::Dependency<'_>,
21        _anim_time: f32,
22        rate: &mut f32,
23        s_a: &SkeletonAttr,
24    ) -> Self::Skeleton {
25        let mut next = (*skeleton).clone();
26        let glider_ori = orientation.inverse() * glider_orientation;
27        let glider_pos = Vec3::new(0.0, -5.0, 13.0);
28        *rate = 1.0;
29
30        next.hand_l.position =
31            glider_pos + glider_ori * Vec3::new(-s_a.hand.0 + -2.0, s_a.hand.1 + 8.0, s_a.hand.2);
32        next.hand_l.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(0.2);
33
34        next.shoulder_r.orientation = glider_ori * Quaternion::rotation_x(2.0);
35        next.shoulder_l.orientation = next.shoulder_r.orientation;
36
37        next.hand_r.position =
38            glider_pos + glider_ori * Vec3::new(s_a.hand.0 + 2.0, s_a.hand.1 + 8.0, s_a.hand.2);
39        next.hand_r.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(-0.2);
40        next.glider.scale = Vec3::one() * 1.0;
41        next.glider.orientation = glider_ori;
42
43        next.glider.position = Vec3::new(0.0, -5.0, 13.0);
44
45        next
46    }
47}