veloren_voxygen_anim/quadruped_medium/
mod.rs

1pub mod combomelee;
2pub mod dash;
3pub mod feed;
4pub mod hoof;
5pub mod idle;
6pub mod jump;
7pub mod leapmelee;
8pub mod run;
9pub mod shockwave;
10pub mod stunned;
11
12// Reexports
13pub use self::{
14    combomelee::ComboAnimation, dash::DashAnimation, feed::FeedAnimation, hoof::HoofAnimation,
15    idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapMeleeAnimation, run::RunAnimation,
16    shockwave::ShockwaveAnimation, stunned::StunnedAnimation,
17};
18
19use super::{FigureBoneData, Offsets, Skeleton, make_bone, vek::*};
20use common::{
21    comp::{self},
22    states::utils::StageSection,
23};
24use core::convert::TryFrom;
25
26pub type Body = comp::quadruped_medium::Body;
27
28skeleton_impls!(struct QuadrupedMediumSkeleton {
29    + head,
30    + neck,
31    + jaw,
32    + tail,
33    + torso_front,
34    + torso_back,
35    + ears,
36    + leg_fl,
37    + leg_fr,
38    + leg_bl,
39    + leg_br,
40    + foot_fl,
41    + foot_fr,
42    + foot_bl,
43    + foot_br,
44    mount,
45});
46
47impl Skeleton for QuadrupedMediumSkeleton {
48    type Attr = SkeletonAttr;
49    type Body = Body;
50
51    const BONE_COUNT: usize = 15;
52    #[cfg(feature = "use-dyn-lib")]
53    const COMPUTE_FN: &'static [u8] = b"quadruped_medium_compute_mats\0";
54
55    #[cfg_attr(
56        feature = "be-dyn-lib",
57        unsafe(export_name = "quadruped_medium_compute_mats")
58    )]
59    fn compute_matrices_inner(
60        &self,
61        base_mat: Mat4<f32>,
62        buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
63        body: Self::Body,
64    ) -> Offsets {
65        let base_mat = base_mat * Mat4::scaling_3d(SkeletonAttr::from(&body).scaler / 11.0);
66
67        let torso_front_mat = base_mat * Mat4::<f32>::from(self.torso_front);
68        let torso_back_mat = torso_front_mat * Mat4::<f32>::from(self.torso_back);
69        let neck_mat = torso_front_mat * Mat4::<f32>::from(self.neck);
70        let leg_fl_mat = torso_front_mat * Mat4::<f32>::from(self.leg_fl);
71        let leg_fr_mat = torso_front_mat * Mat4::<f32>::from(self.leg_fr);
72        let leg_bl_mat = torso_back_mat * Mat4::<f32>::from(self.leg_bl);
73        let leg_br_mat = torso_back_mat * Mat4::<f32>::from(self.leg_br);
74        let head_mat = neck_mat * Mat4::<f32>::from(self.head);
75
76        *(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
77            make_bone(head_mat),
78            make_bone(neck_mat),
79            make_bone(head_mat * Mat4::<f32>::from(self.jaw)),
80            make_bone(torso_back_mat * Mat4::<f32>::from(self.tail)),
81            make_bone(torso_front_mat),
82            make_bone(torso_back_mat),
83            make_bone(head_mat * Mat4::<f32>::from(self.ears)),
84            make_bone(leg_fl_mat),
85            make_bone(leg_fr_mat),
86            make_bone(leg_bl_mat),
87            make_bone(leg_br_mat),
88            make_bone(leg_fl_mat * Mat4::<f32>::from(self.foot_fl)),
89            make_bone(leg_fr_mat * Mat4::<f32>::from(self.foot_fr)),
90            make_bone(leg_bl_mat * Mat4::<f32>::from(self.foot_bl)),
91            make_bone(leg_br_mat * Mat4::<f32>::from(self.foot_br)),
92        ];
93
94        use comp::quadruped_medium::Species::*;
95        let (mount_bone_mat, mount_bone_ori) = match (body.species, body.body_type) {
96            (Mammoth, _) => (
97                head_mat,
98                self.torso_front.orientation * self.neck.orientation * self.head.orientation,
99            ),
100            (Akhlut, _) => (
101                neck_mat,
102                self.torso_front.orientation * self.neck.orientation,
103            ),
104            _ => (torso_front_mat, self.torso_front.orientation),
105        };
106        // Offset from the mounted bone's origin.
107        // Note: This could be its own bone if we need to animate it independently.
108        let mount_position = (mount_bone_mat * Vec4::from_point(mount_point(&body)))
109            .homogenized()
110            .xyz();
111        // NOTE: We apply the ori from base_mat externally so we don't need to worry
112        // about it here for now.
113        let mount_orientation = mount_bone_ori;
114
115        Offsets {
116            viewpoint: match body.species {
117                Akhlut | Catoblepas | Lion => {
118                    Some((head_mat * Vec4::new(0.0, 8.0, 0.0, 1.0)).xyz())
119                },
120                Barghest | Saber => Some((head_mat * Vec4::new(0.0, 8.0, 3.0, 1.0)).xyz()),
121                Cattle | Highland | Bonerattler | Ngoubou | Yak => {
122                    Some((head_mat * Vec4::new(0.0, 6.0, -1.0, 1.0)).xyz())
123                },
124                Antelope | Deer | Donkey | Bear | Mouflon | Panda => {
125                    Some((head_mat * Vec4::new(0.0, 3.0, 3.0, 1.0)).xyz())
126                },
127                Camel | Hirdrasil | Horse | Kelpie | Zebra => {
128                    Some((head_mat * Vec4::new(0.0, 2.0, 5.0, 1.0)).xyz())
129                },
130                Darkhound | Llama | Snowleopard | Tiger | Wolf | ClaySteed => {
131                    Some((head_mat * Vec4::new(0.0, 4.0, 1.0, 1.0)).xyz())
132                },
133                Dreadhorn | Mammoth | Moose | Tarasque => {
134                    Some((head_mat * Vec4::new(0.0, 13.0, -3.0, 1.0)).xyz())
135                },
136                Frostfang => Some((head_mat * Vec4::new(0.0, 5.0, 3.0, 1.0)).xyz()),
137                Grolgar | Roshwalr => Some((head_mat * Vec4::new(0.0, 8.0, 6.0, 1.0)).xyz()),
138                _ => Some((head_mat * Vec4::new(0.0, 2.0, 0.0, 1.0)).xyz()),
139            },
140            mount_bone: Transform {
141                position: mount_position,
142                orientation: mount_orientation,
143                scale: Vec3::one(),
144            },
145            ..Default::default()
146        }
147    }
148}
149
150pub struct SkeletonAttr {
151    head: (f32, f32),
152    neck: (f32, f32),
153    jaw: (f32, f32),
154    tail: (f32, f32),
155    torso_back: (f32, f32),
156    torso_front: (f32, f32),
157    ears: (f32, f32),
158    leg_f: (f32, f32, f32),
159    leg_b: (f32, f32, f32),
160    feet_f: (f32, f32, f32),
161    feet_b: (f32, f32, f32),
162    scaler: f32,
163    startangle: f32,
164    tempo: f32,
165    spring: f32,
166    feed: (bool, f32),
167}
168
169impl<'a> TryFrom<&'a comp::Body> for SkeletonAttr {
170    type Error = ();
171
172    fn try_from(body: &'a comp::Body) -> Result<Self, Self::Error> {
173        match body {
174            comp::Body::QuadrupedMedium(body) => Ok(SkeletonAttr::from(body)),
175            _ => Err(()),
176        }
177    }
178}
179
180impl Default for SkeletonAttr {
181    fn default() -> Self {
182        Self {
183            head: (0.0, 0.0),
184            neck: (0.0, 0.0),
185            jaw: (0.0, 0.0),
186            tail: (0.0, 0.0),
187            torso_back: (0.0, 0.0),
188            torso_front: (0.0, 0.0),
189            ears: (0.0, 0.0),
190            leg_f: (0.0, 0.0, 0.0),
191            leg_b: (0.0, 0.0, 0.0),
192            feet_f: (0.0, 0.0, 0.0),
193            feet_b: (0.0, 0.0, 0.0),
194            scaler: 0.0,
195            startangle: 0.0,
196            tempo: 0.0,
197            spring: 0.0,
198            feed: (false, 0.0),
199        }
200    }
201}
202
203impl<'a> From<&'a Body> for SkeletonAttr {
204    fn from(body: &'a Body) -> Self {
205        use comp::quadruped_medium::{BodyType::*, Species::*};
206        Self {
207            head: match (body.species, body.body_type) {
208                (Grolgar, _) => (0.0, -1.0),
209                (Saber, _) => (5.0, -3.0),
210                (Tuskram, _) => (0.0, 0.0),
211                (Lion, Male) => (4.5, 2.0),
212                (Lion, Female) => (2.5, -2.0),
213                (Tarasque, _) => (-4.0, 3.5),
214                (Tiger, _) => (2.0, 1.0),
215                (Wolf, _) => (1.5, 3.0),
216                (Frostfang, _) => (1.0, -2.0),
217                (Mouflon, _) => (0.5, 1.5),
218                (Catoblepas, _) => (-1.0, -6.5),
219                (Bonerattler, _) => (0.0, 1.5),
220                (Deer, Male) => (1.5, 3.5),
221                (Deer, Female) => (1.5, 3.5),
222                (Hirdrasil, _) => (0.0, 5.0),
223                (Roshwalr, _) => (1.0, 0.5),
224                (Donkey, _) => (4.5, -3.0),
225                (Camel, _) => (-0.5, 5.0),
226                (Zebra, _) => (3.0, -2.0),
227                (Antelope, _) => (1.5, 2.5),
228                (Kelpie, _) => (4.0, -1.0),
229                (Horse, _) => (4.5, 2.5),
230                (Barghest, _) => (0.5, -2.5),
231                (Cattle, Male) => (2.0, 3.5),
232                (Cattle, Female) => (2.5, 4.0),
233                (Darkhound, _) => (3.0, -1.0),
234                (Highland, _) => (2.5, 5.0),
235                (Yak, _) => (2.5, 5.0),
236                (Panda, _) => (0.0, 0.5),
237                (Bear, _) => (0.5, 1.5),
238                (Dreadhorn, _) => (-2.5, 7.0),
239                (Moose, Male) => (-0.5, 5.0),
240                (Moose, Female) => (3.5, 0.5),
241                (Snowleopard, _) => (1.5, 0.5),
242                (Mammoth, _) => (0.5, -1.5),
243                (Ngoubou, _) => (0.5, -2.5),
244                (Llama, _) => (0.5, 10.0),
245                (Alpaca, _) => (0.5, 7.5),
246                (Akhlut, _) => (1.0, 3.5),
247                (Bristleback, _) => (-3.0, -2.0),
248                (ClaySteed, _) => (-0.5, 6.0),
249            },
250            neck: match (body.species, body.body_type) {
251                (Grolgar, _) => (1.0, -1.0),
252                (Saber, _) => (-3.5, -2.0),
253                (Tuskram, _) => (-1.0, 1.0),
254                (Lion, Male) => (-1.5, 1.0),
255                (Lion, Female) => (-2.0, 8.5),
256                (Tarasque, _) => (-1.5, -4.0),
257                (Tiger, _) => (0.0, 0.0),
258                (Wolf, _) => (-4.5, 2.0),
259                (Frostfang, _) => (0.5, 1.5),
260                (Mouflon, _) => (-1.0, 1.0),
261                (Catoblepas, _) => (19.5, -2.0),
262                (Bonerattler, _) => (7.0, -0.5),
263                (Deer, _) => (-2.5, 1.0),
264                (Hirdrasil, _) => (-1.0, 0.5),
265                (Roshwalr, _) => (0.0, 1.0),
266                (Donkey, _) => (1.0, 3.5),
267                (Camel, _) => (3.5, -1.5),
268                (Zebra, _) => (1.0, 3.5),
269                (Antelope, _) => (0.5, 2.5),
270                (Kelpie, _) => (2.0, 1.0),
271                (Horse, _) => (-2.5, -1.5),
272                (Barghest, _) => (0.5, -0.5),
273                (Cattle, Male) => (0.0, 0.0),
274                (Cattle, Female) => (0.0, 0.0),
275                (Darkhound, _) => (1.0, 1.5),
276                (Highland, _) => (0.0, 1.5),
277                (Yak, _) => (0.0, 0.0),
278                (Panda, _) => (0.5, 0.0),
279                (Bear, _) => (0.5, 0.0),
280                (Dreadhorn, _) => (0.5, 0.0),
281                (Moose, _) => (-0.5, 0.5),
282                (Snowleopard, _) => (0.0, 1.5),
283                (Mammoth, _) => (0.5, -0.5),
284                (Ngoubou, _) => (2.0, 1.0),
285                (Llama, _) => (2.5, 4.5),
286                (Alpaca, _) => (-1.5, 3.0),
287                (Akhlut, _) => (8.5, -1.0),
288                (Bristleback, _) => (6.0, 2.5),
289                (ClaySteed, _) => (1.5, 1.5),
290            },
291            jaw: match (body.species, body.body_type) {
292                (Grolgar, _) => (7.0, 2.0),
293                (Saber, _) => (2.5, -2.0),
294                (Tuskram, _) => (4.0, -5.0),
295                (Lion, Male) => (3.5, -4.0),
296                (Lion, Female) => (3.5, -4.0),
297                (Tarasque, _) => (9.0, -9.5),
298                (Tiger, _) => (3.0, -3.5),
299                (Wolf, _) => (5.0, -2.5),
300                (Frostfang, _) => (4.0, -2.5),
301                (Mouflon, _) => (6.0, 1.0),
302                (Catoblepas, _) => (1.0, -3.5),
303                (Bonerattler, _) => (3.0, -2.5),
304                (Deer, _) => (3.5, 2.5),
305                (Hirdrasil, _) => (2.5, 3.0),
306                (Roshwalr, _) => (4.0, -1.0),
307                (Donkey, _) => (1.0, 1.0),
308                (Camel, _) => (2.0, 2.5),
309                (Zebra, _) => (4.0, 0.0),
310                (Antelope, _) => (3.0, 0.5),
311                (Kelpie, _) => (1.0, 1.0),
312                (Horse, _) => (4.0, 1.0),
313                (Barghest, _) => (6.5, -3.0),
314                (Cattle, Male) => (5.0, -5.5),
315                (Cattle, Female) => (5.0, -5.0),
316                (Darkhound, _) => (2.0, -2.0),
317                (Highland, _) => (5.0, -6.0),
318                (Yak, _) => (6.0, -8.0),
319                (Panda, _) => (3.0, -3.0),
320                (Bear, _) => (3.5, -2.0),
321                (Dreadhorn, _) => (7.0, -5.0),
322                (Moose, Male) => (10.0, -7.0),
323                (Moose, Female) => (6.0, -2.5),
324                (Snowleopard, _) => (3.0, -3.0),
325                (Mammoth, _) => (9.5, -3.0),
326                (Ngoubou, _) => (1.5, -4.0),
327                (Llama, _) => (4.0, -1.0),
328                (Alpaca, _) => (3.0, -2.5),
329                (Akhlut, _) => (0.0, -4.5),
330                (Bristleback, _) => (8.0, -6.0),
331                (ClaySteed, _) => (4.0, -1.0),
332            },
333            tail: match (body.species, body.body_type) {
334                (Grolgar, _) => (-11.5, -0.5),
335                (Saber, _) => (-11.0, 0.0),
336                (Tuskram, _) => (-8.0, 2.0),
337                (Lion, Male) => (-11.0, 1.0),
338                (Lion, Female) => (-11.0, 1.0),
339                (Tarasque, _) => (-11.0, 0.0),
340                (Tiger, _) => (-13.5, 3.0),
341                (Wolf, _) => (-11.0, 0.0),
342                (Frostfang, _) => (-7.0, -3.5),
343                (Mouflon, _) => (-10.5, 3.0),
344                (Catoblepas, _) => (-8.0, -2.0),
345                (Bonerattler, _) => (-10.0, 1.5),
346                (Deer, _) => (-8.5, 0.5),
347                (Hirdrasil, _) => (-11.0, 2.0),
348                (Roshwalr, _) => (-8.5, -1.0),
349                (Donkey, _) => (-11.0, 1.5),
350                (Camel, _) => (-14.0, -1.0),
351                (Zebra, _) => (-10.0, 1.5),
352                (Antelope, _) => (-10.0, 2.0),
353                (Kelpie, _) => (-9.0, 3.0),
354                (Horse, _) => (-9.0, 1.5),
355                (Barghest, _) => (-7.0, -4.0),
356                (Cattle, Male) => (-8.0, 3.5),
357                (Cattle, Female) => (-8.0, 5.5),
358                (Darkhound, _) => (-9.0, -3.0),
359                (Highland, _) => (-9.0, 5.0),
360                (Yak, _) => (-8.0, 2.5),
361                (Panda, _) => (-9.5, 0.0),
362                (Bear, _) => (-10.0, -0.5),
363                (Dreadhorn, _) => (-5.5, 1.5),
364                (Moose, _) => (-12.5, 3.5),
365                (Snowleopard, _) => (-10.5, 3.0),
366                (Mammoth, _) => (-13.0, -1.5),
367                (Ngoubou, _) => (-12.0, 5.5),
368                (Llama, _) => (-9.0, 6.0),
369                (Alpaca, _) => (-8.5, 3.5),
370                (Akhlut, _) => (-14.0, -2.0),
371                (Bristleback, _) => (-7.0, -5.5),
372                (ClaySteed, _) => (-11.0, 4.0),
373            },
374            torso_front: match (body.species, body.body_type) {
375                (Grolgar, _) => (10.0, 13.0),
376                (Saber, _) => (14.0, 13.0),
377                (Tuskram, _) => (10.0, 16.0),
378                (Lion, Male) => (10.0, 13.0),
379                (Lion, Female) => (10.0, 13.5),
380                (Tarasque, _) => (11.5, 17.5),
381                (Tiger, _) => (10.0, 13.0),
382                (Wolf, _) => (12.0, 13.0),
383                (Frostfang, _) => (9.0, 11.5),
384                (Mouflon, _) => (11.0, 14.0),
385                (Catoblepas, _) => (7.5, 19.5),
386                (Bonerattler, _) => (6.0, 11.0),
387                (Deer, _) => (11.0, 13.5),
388                (Hirdrasil, _) => (11.0, 14.5),
389                (Roshwalr, _) => (6.0, 12.5),
390                (Donkey, _) => (10.0, 15.5),
391                (Camel, _) => (11.0, 22.5),
392                (Zebra, _) => (10.0, 16.5),
393                (Antelope, _) => (10.0, 14.0),
394                (Kelpie, _) => (10.0, 16.0),
395                (Horse, _) => (7.0, 16.0),
396                (Barghest, _) => (11.5, 15.5),
397                (Cattle, Male) => (7.0, 15.5),
398                (Cattle, Female) => (7.0, 14.5),
399                (Darkhound, _) => (7.0, 14.0),
400                (Highland, _) => (7.0, 12.5),
401                (Yak, _) => (7.0, 15.5),
402                (Panda, _) => (7.0, 13.5),
403                (Bear, _) => (7.0, 14.5),
404                (Dreadhorn, _) => (1.5, 15.5),
405                (Moose, _) => (1.5, 19.5),
406                (Snowleopard, _) => (1.5, 13.0),
407                (Mammoth, _) => (11.5, 20.5),
408                (Ngoubou, _) => (9.5, 16.5),
409                (Llama, _) => (7.0, 15.0),
410                (Alpaca, _) => (7.0, 11.5),
411                (Akhlut, _) => (5.5, 14.5),
412                (Bristleback, _) => (1.5, 9.0),
413                (ClaySteed, _) => (7.0, 15.0),
414            },
415            torso_back: match (body.species, body.body_type) {
416                (Grolgar, _) => (-10.0, 1.5),
417                (Saber, _) => (-13.5, 0.0),
418                (Tuskram, _) => (-12.0, -2.5),
419                (Lion, Male) => (-12.0, -0.5),
420                (Lion, Female) => (-12.0, -0.5),
421                (Tarasque, _) => (-14.0, -1.0),
422                (Tiger, _) => (-13.0, -0.5),
423                (Wolf, _) => (-12.5, 1.0),
424                (Frostfang, _) => (-10.5, 0.0),
425                (Mouflon, _) => (-8.5, -0.5),
426                (Catoblepas, _) => (-8.5, -4.5),
427                (Bonerattler, _) => (-5.0, 0.0),
428                (Deer, _) => (-9.0, 0.5),
429                (Hirdrasil, _) => (-9.0, -0.5),
430                (Roshwalr, _) => (-9.0, -3.5),
431                (Donkey, _) => (-6.0, -1.0),
432                (Camel, _) => (-12.0, -0.5),
433                (Zebra, _) => (-6.0, -1.0),
434                (Antelope, _) => (-7.0, 0.0),
435                (Kelpie, _) => (-8.0, -1.0),
436                (Horse, _) => (-8.0, -1.5),
437                (Barghest, _) => (-9.0, -1.5),
438                (Cattle, Male) => (-8.0, -0.5),
439                (Cattle, Female) => (-10.0, -2.0),
440                (Darkhound, _) => (-12.0, 0.5),
441                (Highland, _) => (-8.0, -0.5),
442                (Yak, _) => (-8.0, -0.5),
443                (Panda, _) => (-11.0, -0.5),
444                (Bear, _) => (-11.0, -0.5),
445                (Dreadhorn, _) => (-20.0, -1.0),
446                (Moose, _) => (-10.0, -1.0),
447                (Snowleopard, _) => (-11.0, 0.0),
448                (Mammoth, _) => (-13.0, -2.5),
449                (Ngoubou, _) => (-8.0, -2.0),
450                (Llama, _) => (-8.0, 0.0),
451                (Alpaca, _) => (-6.0, 0.0),
452                (Akhlut, _) => (-7.0, 1.0),
453                (Bristleback, _) => (-4.0, 2.0),
454                (ClaySteed, _) => (-6.0, 0.0),
455            },
456            ears: match (body.species, body.body_type) {
457                (Grolgar, _) => (5.0, 8.0),
458                (Saber, _) => (3.0, 5.5),
459                (Tuskram, _) => (0.0, 0.0),
460                (Lion, Male) => (2.0, 3.5),
461                (Lion, Female) => (2.0, 1.0),
462                (Tarasque, _) => (12.0, -3.0),
463                (Tiger, _) => (2.5, 4.0),
464                (Wolf, _) => (3.0, 2.5),
465                (Frostfang, _) => (2.0, 3.5),
466                (Mouflon, _) => (2.5, 5.0),
467                (Catoblepas, _) => (11.0, -3.0),
468                (Bonerattler, _) => (2.0, 3.5),
469                (Deer, _) => (2.5, 5.0),
470                (Hirdrasil, _) => (2.5, 5.0),
471                (Roshwalr, _) => (5.0, 8.0),
472                (Donkey, _) => (-1.0, 8.0),
473                (Camel, _) => (2.5, 5.0),
474                (Zebra, _) => (0.0, 7.0),
475                (Antelope, _) => (2.5, 5.0),
476                (Kelpie, _) => (1.0, 7.5),
477                (Horse, _) => (1.0, 7.0),
478                (Barghest, _) => (12.0, -3.0),
479                (Cattle, Male) => (2.0, -1.5),
480                (Cattle, Female) => (2.0, -1.5),
481                (Darkhound, _) => (1.0, 2.5),
482                (Highland, _) => (2.0, -1.5),
483                (Yak, _) => (3.0, -5.0),
484                (Panda, _) => (1.0, 4.0),
485                (Bear, _) => (1.0, 4.0),
486                (Dreadhorn, _) => (1.5, 3.0),
487                (Moose, Male) => (6.0, 1.0),
488                (Moose, Female) => (2.0, 4.5),
489                (Snowleopard, _) => (1.5, 3.0),
490                (Mammoth, _) => (12.0, -3.0),
491                (Ngoubou, _) => (12.0, -3.0),
492                (Llama, _) => (1.0, 3.5),
493                (Alpaca, _) => (1.0, 2.0),
494                (Akhlut, _) => (12.0, -3.0),
495                (Bristleback, _) => (6.0, 1.0),
496                (ClaySteed, _) => (1.0, 3.5),
497            },
498            leg_f: match (body.species, body.body_type) {
499                (Grolgar, _) => (7.5, -5.5, -1.0),
500                (Saber, _) => (7.0, -4.0, -2.5),
501                (Tuskram, _) => (8.5, -4.5, -2.0),
502                (Lion, Male) => (6.5, -6.5, -1.5),
503                (Lion, Female) => (6.5, -6.5, -1.5),
504                (Tarasque, _) => (7.0, -8.0, -6.0),
505                (Tiger, _) => (6.0, -6.0, -1.5),
506                (Wolf, _) => (4.5, -6.5, -1.5),
507                (Frostfang, _) => (5.5, -5.5, -2.0),
508                (Mouflon, _) => (4.0, -5.0, -4.0),
509                (Catoblepas, _) => (7.0, 2.0, -5.0),
510                (Bonerattler, _) => (5.5, 5.0, -2.5),
511                (Deer, _) => (3.5, -4.5, -3.5),
512                (Hirdrasil, _) => (4.5, -5.0, -2.5),
513                (Roshwalr, _) => (8.0, -2.5, -2.5),
514                (Donkey, _) => (4.0, -3.5, -4.0),
515                (Camel, _) => (4.5, -3.5, -5.5),
516                (Zebra, _) => (4.0, -2.5, -4.5),
517                (Antelope, _) => (4.0, -4.5, -2.5),
518                (Kelpie, _) => (4.5, -3.5, -3.5),
519                (Horse, _) => (4.5, -2.5, -3.0),
520                (Barghest, _) => (9.5, 0.0, -2.5),
521                (Cattle, Male) => (5.5, -2.0, -2.5),
522                (Cattle, Female) => (5.5, -2.5, -1.0),
523                (Darkhound, _) => (4.0, -6.5, -2.0),
524                (Highland, _) => (5.5, -2.5, 0.0),
525                (Yak, _) => (4.5, -2.0, -1.5),
526                (Panda, _) => (7.5, -5.5, -2.0),
527                (Bear, _) => (5.5, -4.5, -3.5),
528                (Dreadhorn, _) => (8.5, -7.0, -0.5),
529                (Moose, _) => (5.5, -4.0, 1.0),
530                (Snowleopard, _) => (6.5, -4.0, -2.5),
531                (Mammoth, _) => (10.0, -5.0, -5.0),
532                (Ngoubou, _) => (7.5, -4.0, -1.5),
533                (Llama, _) => (5.0, -1.5, -1.0),
534                (Alpaca, _) => (3.5, -2.5, -0.5),
535                (Akhlut, _) => (8.0, -2.0, 0.5),
536                (Bristleback, _) => (6.0, 1.0, -2.0),
537                (ClaySteed, _) => (4.0, -1.5, -2.0),
538            },
539            leg_b: match (body.species, body.body_type) {
540                (Grolgar, _) => (6.0, -6.5, -4.0),
541                (Saber, _) => (6.0, -7.0, -3.5),
542                (Tuskram, _) => (6.0, -5.5, -2.5),
543                (Lion, Male) => (6.0, -5.0, -1.5),
544                (Lion, Female) => (6.0, -5.0, -1.5),
545                (Tarasque, _) => (6.0, -6.5, -6.5),
546                (Tiger, _) => (6.0, -7.0, -1.0),
547                (Wolf, _) => (5.0, -6.5, -3.0),
548                (Frostfang, _) => (3.5, -4.5, -2.0),
549                (Mouflon, _) => (3.5, -8.0, -3.5),
550                (Catoblepas, _) => (6.0, -2.5, -2.5),
551                (Bonerattler, _) => (6.0, -8.0, -2.5),
552                (Deer, _) => (3.0, -6.5, -3.5),
553                (Hirdrasil, _) => (4.0, -6.5, -3.0),
554                (Roshwalr, _) => (7.0, -7.0, -2.5),
555                (Donkey, _) => (4.0, -9.0, -3.0),
556                (Camel, _) => (4.5, -10.5, -5.0),
557                (Zebra, _) => (3.5, -8.0, -3.5),
558                (Antelope, _) => (3.5, -7.5, -3.5),
559                (Kelpie, _) => (3.5, -7.0, -2.5),
560                (Horse, _) => (3.5, -7.0, -2.0),
561                (Barghest, _) => (7.0, -3.5, -5.5),
562                (Cattle, Male) => (4.0, -7.0, -1.0),
563                (Cattle, Female) => (4.0, -6.5, 0.0),
564                (Darkhound, _) => (4.0, -6.5, -3.0),
565                (Highland, _) => (4.5, -7.0, 0.0),
566                (Yak, _) => (4.5, -6.0, -1.0),
567                (Panda, _) => (7.0, -7.0, -2.0),
568                (Bear, _) => (6.5, -6.5, -2.0),
569                (Dreadhorn, _) => (6.0, 0.0, -3.0),
570                (Moose, _) => (4.5, -10.0, -2.0),
571                (Snowleopard, _) => (5.5, -5.0, -1.5),
572                (Mammoth, _) => (7.5, -7.0, -5.0),
573                (Ngoubou, _) => (4.5, -9.5, 0.0),
574                (Llama, _) => (5.0, -7.0, -2.0),
575                (Alpaca, _) => (3.5, -7.0, 0.0),
576                (Akhlut, _) => (6.0, -7.5, -2.0),
577                (Bristleback, _) => (4.5, -3.0, -2.0),
578                (ClaySteed, _) => (4.5, -8.0, -3.0),
579            },
580            feet_f: match (body.species, body.body_type) {
581                (Grolgar, _) => (0.0, 0.0, -4.0),
582                (Saber, _) => (1.0, -3.5, -2.5),
583                (Tuskram, _) => (-1.0, -1.5, -6.0),
584                (Lion, Male) => (0.5, 0.5, -3.5),
585                (Lion, Female) => (0.5, 0.5, -3.5),
586                (Tarasque, _) => (1.0, 0.0, -3.0),
587                (Tiger, _) => (0.5, 0.0, -4.5),
588                (Wolf, _) => (0.5, 0.0, -2.0),
589                (Frostfang, _) => (0.5, 1.5, -3.5),
590                (Mouflon, _) => (-0.5, -0.5, -3.0),
591                (Catoblepas, _) => (1.0, 0.0, -6.0),
592                (Bonerattler, _) => (-0.5, -3.0, -2.5),
593                (Deer, _) => (-0.5, -0.5, -2.5),
594                (Hirdrasil, _) => (-0.5, -3.0, -3.5),
595                (Roshwalr, _) => (0.5, 0.0, -3.0),
596                (Donkey, _) => (0.5, 1.0, -3.5),
597                (Camel, _) => (0.0, 0.0, -8.0),
598                (Zebra, _) => (-0.5, 0.5, -4.0),
599                (Antelope, _) => (-0.5, 0.0, -3.5),
600                (Kelpie, _) => (-0.5, 0.5, -4.5),
601                (Horse, _) => (-0.5, 0.5, -5.0),
602                (Barghest, _) => (2.0, 2.5, -6.0),
603                (Cattle, Male) => (-0.5, 1.0, -5.0),
604                (Cattle, Female) => (-0.5, 0.5, -5.5),
605                (Darkhound, _) => (0.0, 0.5, -4.0),
606                (Highland, _) => (-0.5, 0.5, -4.5),
607                (Yak, _) => (-0.5, 0.0, -5.0),
608                (Panda, _) => (-1.0, 2.0, -4.5),
609                (Bear, _) => (0.0, 2.0, -5.5),
610                (Dreadhorn, _) => (-0.5, 0.5, -5.0),
611                (Moose, _) => (-1.0, 1.5, -9.5),
612                (Snowleopard, _) => (0.5, 0.5, -4.5),
613                (Mammoth, _) => (-0.5, -0.5, -6.0),
614                (Ngoubou, _) => (-1.0, 0.5, -6.0),
615                (Llama, _) => (-0.5, 0.5, -6.0),
616                (Alpaca, _) => (0.0, -0.5, -5.0),
617                (Akhlut, _) => (0.0, 0.0, -5.0),
618                (Bristleback, _) => (0.0, -0.5, -2.0),
619                (ClaySteed, _) => (-0.5, 0.0, -6.0),
620            },
621            feet_b: match (body.species, body.body_type) {
622                (Grolgar, _) => (0.5, -1.5, -3.0),
623                (Saber, _) => (1.0, -1.0, -1.0),
624                (Tuskram, _) => (0.5, -1.0, -3.0),
625                (Lion, Male) => (0.5, -1.0, -3.0),
626                (Lion, Female) => (0.5, -1.0, -3.0),
627                (Tarasque, _) => (1.5, -1.0, -2.5),
628                (Tiger, _) => (0.5, -1.0, -4.0),
629                (Wolf, _) => (0.0, -1.0, -1.5),
630                (Frostfang, _) => (0.0, -1.5, -3.5),
631                (Mouflon, _) => (-1.0, 0.0, -0.5),
632                (Catoblepas, _) => (0.5, 0.5, -4.0),
633                (Bonerattler, _) => (0.0, 3.0, -2.5),
634                (Deer, _) => (-1.0, -0.5, -2.0),
635                (Hirdrasil, _) => (-1.0, -2.0, -4.5),
636                (Roshwalr, _) => (0.5, -1.0, -3.5),
637                (Donkey, _) => (0.5, -1.0, -3.5),
638                (Camel, _) => (0.0, 0.5, -9.0),
639                (Zebra, _) => (0.5, -1.0, -3.0),
640                (Antelope, _) => (-0.5, -1.5, -3.5),
641                (Kelpie, _) => (0.5, -0.5, -3.5),
642                (Horse, _) => (0.5, -1.5, -3.5),
643                (Barghest, _) => (0.5, 1.0, -4.5),
644                (Cattle, Male) => (-0.5, -0.5, -5.0),
645                (Cattle, Female) => (-0.5, -1.0, -3.5),
646                (Darkhound, _) => (0.0, -1.0, -3.5),
647                (Highland, _) => (-0.5, -0.5, -3.0),
648                (Yak, _) => (-0.5, -0.5, -5.0),
649                (Panda, _) => (-0.5, 0.5, -5.0),
650                (Bear, _) => (0.5, 0.5, -6.0),
651                (Dreadhorn, _) => (-0.5, 0.5, -3.5),
652                (Moose, _) => (-1.0, 0.0, -6.5),
653                (Snowleopard, _) => (0.5, 0.5, -5.5),
654                (Mammoth, _) => (0.5, -0.5, -4.5),
655                (Ngoubou, _) => (0.5, 1.0, -5.5),
656                (Llama, _) => (0.5, -1.5, -3.5),
657                (Alpaca, _) => (-0.5, -0.5, -5.5),
658                (Akhlut, _) => (1.5, -1.0, -4.5),
659                (Bristleback, _) => (-0.5, 0.0, -4.0),
660                (ClaySteed, _) => (0.0, -0.5, -4.0),
661            },
662            scaler: match (body.species, body.body_type) {
663                (Grolgar, _) => 1.05,
664                (Saber, _) => 0.9,
665                (Tuskram, _) => 0.95,
666                (Lion, Male) => 1.05,
667                (Lion, Female) => 1.05,
668                (Tarasque, _) => 1.05,
669                (Tiger, _) => 0.95,
670                (Catoblepas, _) => 1.05,
671                (Roshwalr, _) => 1.75,
672                (Barghest, _) => 1.2,
673                (Antelope, _) => 0.95,
674                (Kelpie, _) => 1.1,
675                (Donkey, _) => 0.95,
676                (Horse, _) => 1.2,
677                (Zebra, _) => 1.05,
678                (Cattle, _) => 1.25,
679                (Highland, _) => 1.32,
680                (Bear, _) => 1.4,
681                (Yak, _) => 1.4,
682                (Camel, _) => 1.15,
683                (Dreadhorn, _) => 1.6,
684                (Moose, _) => 0.95,
685                (Snowleopard, _) => 0.95,
686                (Mammoth, _) => 3.0,
687                (Ngoubou, _) => 1.2,
688                (Akhlut, _) => 1.4,
689                (Bristleback, _) => 1.1,
690                (ClaySteed, _) => 1.75,
691                (Frostfang, _) => 1.0,
692                _ => 0.9,
693            },
694            startangle: match (body.species, body.body_type) {
695                //changes the default angle of front feet
696                (Grolgar, _) => -0.3,
697                (Saber, _) => -0.2,
698                (Tuskram, _) => 0.3,
699                (Lion, Male) => -0.1,
700                (Lion, Female) => -0.1,
701                (Tarasque, _) => -0.5,
702                (Catoblepas, _) => -0.5,
703                (Bonerattler, _) => -0.7,
704                (Roshwalr, _) => -0.3,
705                (Barghest, _) => -0.5,
706                _ => 0.0,
707            },
708            tempo: match (body.species, body.body_type) {
709                (Grolgar, _) => 0.85,
710                (Saber, _) => 1.1,
711                (Tuskram, _) => 0.9,
712                (Lion, Male) => 0.95,
713                (Lion, Female) => 0.95,
714                (Tarasque, _) => 0.95,
715                (Wolf, _) => 1.1,
716                (Mouflon, _) => 0.85,
717                (Catoblepas, _) => 1.1,
718                (Deer, _) => 0.85,
719                (Hirdrasil, _) => 0.85,
720                (Roshwalr, _) => 0.75,
721                (Donkey, _) => 0.85,
722                (Zebra, _) => 0.85,
723                (Kelpie, _) => 0.85,
724                (Horse, _) => 0.85,
725                (Barghest, _) => 0.95,
726                (Darkhound, _) => 1.1,
727                (Cattle, _) => 0.8,
728                (Highland, _) => 0.8,
729                (Bear, _) => 0.8,
730                (Yak, _) => 0.8,
731                (Camel, _) => 1.8,
732                (Akhlut, _) => 0.95,
733                _ => 1.0,
734            },
735            spring: match (body.species, body.body_type) {
736                (Grolgar, _) => 0.9,
737                (Saber, _) => 0.9,
738                (Tuskram, _) => 0.9,
739                (Wolf, _) => 1.2,
740                (Mouflon, _) => 0.9,
741                (Catoblepas, _) => 0.55,
742                (Bonerattler, _) => 1.1,
743                (Deer, _) => 0.9,
744                (Hirdrasil, _) => 1.1,
745                (Donkey, _) => 0.85,
746                (Camel, _) => 0.85,
747                (Zebra, _) => 0.85,
748                (Antelope, _) => 1.2,
749                (Kelpie, _) => 0.95,
750                (Horse, _) => 0.85,
751                (Darkhound, _) => 1.2,
752                (Dreadhorn, _) => 0.85,
753                (Moose, _) => 0.9,
754                (Snowleopard, _) => 1.1,
755                _ => 1.0,
756            },
757            feed: match (body.species, body.body_type) {
758                // TODO: Rework some species to allow for feed anim
759                (Tuskram, _) => (true, 0.5),
760                (Mouflon, _) => (true, 0.7),
761                (Deer, _) => (true, 1.0),
762                (Hirdrasil, _) => (true, 0.9),
763                (Donkey, _) => (false, 1.0),
764                (Zebra, _) => (true, 1.0),
765                (Antelope, _) => (false, 0.9),
766                (Kelpie, _) => (false, 1.0),
767                (Horse, _) => (true, 0.85),
768                _ => (false, 0.0),
769            },
770        }
771    }
772}
773
774fn mount_point(body: &Body) -> Vec3<f32> {
775    use comp::quadruped_medium::{BodyType::*, Species::*};
776    match (body.species, body.body_type) {
777        (Grolgar, _) => (0.0, -6.0, 8.0),
778        (Saber, _) => (0.0, -17.0, 5.5),
779        (Tuskram, _) => (0.0, -17.0, 4.0),
780        (Lion, Male) => (0.0, -8.0, 6.0),
781        (Lion, Female) => (0.0, -8.0, 6.0),
782        (Tarasque, _) => (0.0, -6.0, 6.0),
783        (Tiger, _) => (0.0, -8.0, 6.0),
784        (Wolf, _) => (0.0, -9.0, 5.0),
785        (Frostfang, _) => (0.0, -10.0, 3.5),
786        (Mouflon, _) => (0.0, -8.5, 3.5),
787        (Catoblepas, _) => (0.0, -8.5, 3.5),
788        (Bonerattler, _) => (0.0, -1.0, 5.0),
789        (Deer, _) => (0.0, -9.0, 4.0),
790        (Hirdrasil, _) => (0.0, -11.0, 3.5),
791        (Roshwalr, _) => (0.0, -1.0, 8.0),
792        (Donkey, _) => (0.0, -7.0, 5.5),
793        (Camel, _) => (0.0, -13.0, 4.5),
794        (Zebra, _) => (0.0, -7.0, 4.5),
795        (Antelope, _) => (0.0, -8.0, 3.5),
796        (Kelpie, _) => (0.0, -6.0, 4.5),
797        (Horse, _) => (0.0, -8.0, 4.0),
798        (Barghest, _) => (0.0, -8.0, 7.5),
799        (Cattle, Male) => (0.0, -3.0, 8.0),
800        (Cattle, Female) => (0.0, -2.0, 6.5),
801        (Darkhound, _) => (0.0, -2.0, 4.0),
802        (Highland, _) => (0.0, -3.0, 8.5),
803        (Yak, _) => (0.0, -7.5, 9.0),
804        (Panda, _) => (0.0, -10.5, 5.5),
805        (Bear, _) => (0.0, -11.0, 5.5),
806        (Dreadhorn, _) => (0.0, -1.5, 11.5),
807        (Moose, _) => (0.0, -9.0, 7.0),
808        (Snowleopard, _) => (0.0, -9.0, 5.0),
809        (Mammoth, _) => (0.0, 5.0, 8.0),
810        (Ngoubou, _) => (0.0, -7.5, 7.5),
811        (Llama, _) => (0.0, -6.0, 5.0),
812        (Alpaca, _) => (0.0, -9.0, 4.0),
813        (Akhlut, _) => (0.0, -0.5, 8.5),
814        (Bristleback, _) => (0.0, -7.0, 6.0),
815        (ClaySteed, _) => (0.0, -9.0, 3.0),
816    }
817    .into()
818}
819
820pub fn quadruped_medium_alpha(
821    next: &mut QuadrupedMediumSkeleton,
822    s_a: &SkeletonAttr,
823    speed: f32,
824    stage_section: StageSection,
825    anim_time: f32,
826    global_time: f32,
827    timer: f32,
828) {
829    let speed = (Vec2::<f32>::from(speed).magnitude()).min(24.0);
830
831    let (movement1base, movement2base, movement3) = match stage_section {
832        StageSection::Buildup => (anim_time.powf(0.25), 0.0, 0.0),
833        StageSection::Action => (1.0, anim_time.powf(0.25), 0.0),
834        StageSection::Recover => (1.0, 1.0, anim_time.powi(4)),
835        _ => (0.0, 0.0, 0.0),
836    };
837    let pullback = 1.0 - movement3;
838    let subtract = global_time - timer;
839    let check = subtract - subtract.trunc();
840    let mirror = (check - 0.5).signum();
841    let movement1 = movement1base * mirror * pullback;
842    let movement1abs = movement1base * pullback;
843    let movement2 = movement2base * mirror * pullback;
844    let movement2abs = movement2base * pullback;
845    let twitch1 = (movement1 * 10.0).sin() * pullback;
846    let twitch2 = (movement3 * 5.0).sin() * pullback;
847    let twitchmovement = twitch1 + twitch2;
848
849    next.head.orientation = Quaternion::rotation_x(movement1abs * -0.3 + movement2abs * 0.6)
850        * Quaternion::rotation_y(movement1 * 0.35 + movement2 * -0.15)
851        * Quaternion::rotation_z(movement1 * 0.15 + movement2 * -0.5);
852
853    next.neck.orientation = Quaternion::rotation_x(movement1abs * 0.2 + movement2abs * -0.2)
854        * Quaternion::rotation_y(movement1 * 0.0)
855        * Quaternion::rotation_z(movement1 * 0.10 + movement1 * -0.15);
856
857    next.jaw.orientation = Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * 0.4);
858
859    next.tail.orientation =
860        Quaternion::rotation_z(movement1 * 0.5 + movement2 * -0.8 + twitchmovement * 0.2 * mirror);
861    next.torso_front.position = Vec3::new(
862        0.0,
863        s_a.torso_front.0 + movement1abs * -4.0,
864        s_a.torso_front.1,
865    );
866    next.torso_front.orientation = Quaternion::rotation_y(movement1 * -0.25 * movement2 * 0.25)
867        * Quaternion::rotation_z(movement1 * 0.35 + movement2 * -0.45);
868
869    next.torso_back.orientation = Quaternion::rotation_y(movement1 * 0.25 + movement1 * -0.25)
870        * Quaternion::rotation_z(movement1 * -0.4 + movement2 * 0.65);
871
872    next.ears.orientation = Quaternion::rotation_x(twitchmovement * 0.2);
873    if speed < 0.5 {
874        next.leg_fl.orientation = Quaternion::rotation_x(movement1abs * 0.8 + movement2abs * -0.6)
875            * Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
876            * Quaternion::rotation_z(movement1 * -0.35 + movement2 * 0.45);
877
878        next.leg_fr.orientation = Quaternion::rotation_x(movement1abs * 0.8 + movement2abs * -0.6)
879            * Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
880            * Quaternion::rotation_z(movement1 * -0.35 + movement2 * 0.45);
881
882        next.leg_bl.orientation = Quaternion::rotation_x(movement1 * 0.1 + movement2 * -0.3);
883
884        next.leg_br.orientation = Quaternion::rotation_x(movement1 * -0.1 + movement2 * 0.3);
885
886        next.foot_fl.orientation = Quaternion::rotation_x(movement1abs * -0.9 + movement2abs * 0.6);
887
888        next.foot_fr.orientation = Quaternion::rotation_x(movement1abs * -0.9 + movement2abs * 0.6);
889
890        next.foot_bl.orientation =
891            Quaternion::rotation_x(movement1abs * -0.5 + movement2abs * -0.3);
892
893        next.foot_br.orientation =
894            Quaternion::rotation_x(movement1abs * -0.5 + movement2abs * -0.3);
895    };
896}
897
898pub fn quadruped_medium_beta(
899    next: &mut QuadrupedMediumSkeleton,
900    s_a: &SkeletonAttr,
901    speed: f32,
902    stage_section: StageSection,
903    anim_time: f32,
904    global_time: f32,
905    timer: f32,
906) {
907    let speed = (Vec2::<f32>::from(speed).magnitude()).min(24.0);
908
909    let (movement1base, movement2base, movement3) = match stage_section {
910        StageSection::Buildup => (anim_time.powf(0.25), 0.0, 0.0),
911        StageSection::Action => (1.0, anim_time.sqrt(), 0.0),
912        StageSection::Recover => (1.0, 1.0, anim_time.powi(4)),
913        _ => (0.0, 0.0, 0.0),
914    };
915    let pullback = 1.0 - movement3;
916    let subtract = global_time - timer;
917    let check = subtract - subtract.trunc();
918    let mirror = (check - 0.5).signum();
919    let movement1 = movement1base * mirror * pullback;
920    let movement1abs = movement1base * pullback;
921    let movement2 = movement2base * mirror * pullback;
922    let movement2abs = movement2base * pullback;
923    let twitch1 = (movement1 * 10.0).sin() * pullback;
924    let twitch2 = (movement2abs * -8.0).sin();
925    let twitchmovement = twitch1 + twitch2;
926
927    next.head.orientation = Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * 1.1)
928        * Quaternion::rotation_y(movement1 * -0.35 + movement2 * 0.25)
929        * Quaternion::rotation_z(movement1 * -0.25 + movement2 * 0.5);
930
931    next.neck.orientation = Quaternion::rotation_x(movement1abs * 0.0 + movement2abs * -0.2)
932        * Quaternion::rotation_y(movement1 * 0.0)
933        * Quaternion::rotation_z(movement1 * -0.10 + movement1 * 0.15);
934
935    next.jaw.orientation = Quaternion::rotation_x(movement1abs * -0.5 + twitch2 * -0.4);
936
937    next.tail.orientation =
938        Quaternion::rotation_z(movement1 * 0.5 + movement2 * -0.8 + twitchmovement * 0.2 * mirror);
939    next.torso_front.position = Vec3::new(
940        0.0,
941        s_a.torso_front.0 + movement1abs * -4.0,
942        s_a.torso_front.1,
943    );
944    next.torso_front.orientation = Quaternion::rotation_y(movement1 * -0.25 * movement2 * 0.25)
945        * Quaternion::rotation_z(movement1 * 0.35 + movement2 * -0.45);
946
947    next.torso_back.orientation = Quaternion::rotation_y(movement1 * 0.25 + movement1 * -0.25)
948        * Quaternion::rotation_z(movement1 * -0.4 + movement2 * 0.65);
949
950    next.ears.orientation = Quaternion::rotation_x(twitchmovement * 0.2);
951    if speed < 0.5 {
952        next.leg_fl.orientation = Quaternion::rotation_x(movement1abs * 0.8 + movement2abs * -0.6)
953            * Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
954            * Quaternion::rotation_z(movement1 * -0.35 + movement2 * 0.45);
955
956        next.leg_fr.orientation = Quaternion::rotation_x(movement1abs * 0.8 + movement2abs * -0.6)
957            * Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
958            * Quaternion::rotation_z(movement1 * -0.35 + movement2 * 0.45);
959
960        next.leg_bl.orientation = Quaternion::rotation_x(movement1 * 0.1 + movement2 * -0.3);
961
962        next.leg_br.orientation = Quaternion::rotation_x(movement1 * -0.1 + movement2 * 0.3);
963
964        next.foot_fl.orientation = Quaternion::rotation_x(movement1abs * -0.9 + movement2abs * 0.6);
965
966        next.foot_fr.orientation = Quaternion::rotation_x(movement1abs * -0.9 + movement2abs * 0.6);
967
968        next.foot_bl.orientation =
969            Quaternion::rotation_x(movement1abs * -0.5 + movement2abs * -0.3);
970
971        next.foot_br.orientation =
972            Quaternion::rotation_x(movement1abs * -0.5 + movement2abs * -0.3);
973    };
974}