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