veloren_voxygen_anim/character/
glidewield.rs1use 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", unsafe(export_name = "character_glidewield"))]
17 fn update_skeleton_inner(
18 skeleton: &Self::Skeleton,
19 (orientation, glider_orientation): Self::Dependency<'_>,
20 _anim_time: f32,
21 rate: &mut f32,
22 s_a: &SkeletonAttr,
23 ) -> Self::Skeleton {
24 let mut next = (*skeleton).clone();
25 let glider_ori = orientation.inverse() * glider_orientation;
26 let glider_pos = Vec3::new(0.0, -5.0, 13.0);
27 *rate = 1.0;
28
29 next.hand_l.position =
30 glider_pos + glider_ori * Vec3::new(-s_a.hand.0 + -2.0, s_a.hand.1 + 8.0, s_a.hand.2);
31 next.hand_l.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(0.2);
32
33 next.shoulder_r.orientation = glider_ori * Quaternion::rotation_x(2.0);
34 next.shoulder_l.orientation = next.shoulder_r.orientation;
35
36 next.hand_r.position =
37 glider_pos + glider_ori * Vec3::new(s_a.hand.0 + 2.0, s_a.hand.1 + 8.0, s_a.hand.2);
38 next.hand_r.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(-0.2);
39 next.glider.scale = Vec3::one() * 1.0;
40 next.glider.orientation = glider_ori;
41
42 next.glider.position = Vec3::new(0.0, -5.0, 13.0);
43
44 next
45 }
46}