veloren_voxygen_anim/arthropod/
basic.rs

1use super::{
2    super::{Animation, vek::*},
3    ArthropodSkeleton, SkeletonAttr,
4};
5use common::states::utils::StageSection;
6use std::f32::consts::PI;
7
8pub struct BasicAction;
9
10pub struct BasicActionDependency<'a> {
11    pub ability_id: Option<&'a str>,
12    pub stage_section: Option<StageSection>,
13    pub global_time: f32,
14    pub timer: f32,
15}
16
17impl Animation for BasicAction {
18    type Dependency<'a> = BasicActionDependency<'a>;
19    type Skeleton = ArthropodSkeleton;
20
21    #[cfg(feature = "use-dyn-lib")]
22    const UPDATE_FN: &'static [u8] = b"arthropod_shoot\0";
23
24    #[cfg_attr(feature = "be-dyn-lib", export_name = "arthropod_shoot")]
25    fn update_skeleton_inner(
26        skeleton: &Self::Skeleton,
27        d: Self::Dependency<'_>,
28        anim_time: f32,
29        _rate: &mut f32,
30        s_a: &SkeletonAttr,
31    ) -> Self::Skeleton {
32        let mut next = (*skeleton).clone();
33
34        let (move1base, _chargebase, movementbase, move2base, move3base) = match d.stage_section {
35            Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0, 0.0),
36            Some(StageSection::Charge) => (1.0, anim_time, 0.0, 0.0, 0.0),
37            Some(StageSection::Movement) => (1.0, 1.0, anim_time, 0.0, 0.0),
38            Some(StageSection::Action) => (1.0, 1.0, 1.0, anim_time, 0.0),
39            Some(StageSection::Recover) => (1.0, 1.0, 1.0, 1.0, anim_time),
40            _ => (0.0, 0.0, 0.0, 0.0, 0.0),
41        };
42        let pullback = 1.0 - move3base;
43        let _move1 = move1base * pullback;
44        let _move2 = move2base * pullback;
45
46        match d.ability_id {
47            Some(
48                "common.abilities.custom.arthropods.blackwidow.poisonball"
49                | "common.abilities.custom.arthropods.weevil.threadshot"
50                | "common.abilities.custom.arthropods.crawler.threadshot",
51            ) => {
52                let movement1abs = move1base.powf(0.25) * pullback;
53                let twitch = (move1base * 30.0).sin();
54
55                next.chest.scale = Vec3::one() * s_a.scaler;
56                next.chest.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
57
58                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
59                next.head.orientation =
60                    Quaternion::rotation_x(movement1abs * 0.35 + twitch * -0.02)
61                        * Quaternion::rotation_y(0.0);
62
63                next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
64
65                next.mandible_l.position =
66                    Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
67                next.mandible_r.position =
68                    Vec3::new(s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
69                next.mandible_l.orientation =
70                    Quaternion::rotation_x(movement1abs * 0.5 + twitch * 0.2)
71                        * Quaternion::rotation_y(movement1abs * 0.5)
72                        * Quaternion::rotation_z(movement1abs * 0.5);
73                next.mandible_r.orientation =
74                    Quaternion::rotation_x(movement1abs * 0.5 + twitch * 0.2)
75                        * Quaternion::rotation_y(movement1abs * -0.5)
76                        * Quaternion::rotation_z(movement1abs * -0.5);
77
78                next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
79                next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
80
81                next.wing_bl.position = Vec3::new(-s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
82                next.wing_br.position = Vec3::new(s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
83
84                next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
85                next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
86                next.leg_fl.orientation =
87                    Quaternion::rotation_z(s_a.leg_ori.0 + movement1abs * 0.4)
88                        * Quaternion::rotation_x(movement1abs * 1.0);
89                next.leg_fr.orientation =
90                    Quaternion::rotation_z(-s_a.leg_ori.0 + movement1abs * -0.4)
91                        * Quaternion::rotation_x(movement1abs * 1.0);
92
93                next.leg_fcl.orientation =
94                    Quaternion::rotation_z(s_a.leg_ori.1 + movement1abs * 0.2)
95                        * Quaternion::rotation_y(movement1abs * 0.5);
96                next.leg_fcr.orientation =
97                    Quaternion::rotation_z(-s_a.leg_ori.1 + movement1abs * -0.2)
98                        * Quaternion::rotation_y(movement1abs * -0.5);
99
100                next.leg_fcl.position = Vec3::new(-s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
101                next.leg_fcr.position = Vec3::new(s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
102
103                next.leg_bcl.position = Vec3::new(-s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
104                next.leg_bcr.position = Vec3::new(s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
105
106                next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
107                next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
108            },
109            Some("common.abilities.custom.arthropods.antlion.charge") => {
110                let movement1abs = move1base.powi(4) * pullback;
111                let movement2abs = move2base.powi(6) * pullback;
112                let chargemovementbase = if matches!(d.stage_section, Some(StageSection::Buildup)) {
113                    0.0
114                } else {
115                    1.0
116                };
117                let shortalt =
118                    (anim_time * 200.0 + PI * 0.25).sin() * chargemovementbase * pullback;
119
120                next.chest.scale = Vec3::one() * s_a.scaler;
121
122                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
123                next.head.orientation =
124                    Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * 1.4);
125
126                next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
127
128                next.mandible_l.position =
129                    Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
130                next.mandible_r.position =
131                    Vec3::new(s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
132                next.mandible_l.orientation =
133                    Quaternion::rotation_z(movement1abs * 0.5 + movement2abs * -0.7);
134                next.mandible_r.orientation =
135                    Quaternion::rotation_z(movement1abs * -0.5 + movement2abs * 0.7);
136
137                next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
138                next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
139                next.wing_fl.orientation = Quaternion::rotation_x(
140                    movement1abs * -0.4 + shortalt * 0.2 + movement2abs * -0.6,
141                ) * Quaternion::rotation_y(
142                    movement1abs * -0.5 + movement2abs * -0.1,
143                ) * Quaternion::rotation_z(movement1abs * -0.2);
144                next.wing_fr.orientation = Quaternion::rotation_x(
145                    movement1abs * -0.4 + shortalt * 0.2 + movement2abs * -0.6,
146                ) * Quaternion::rotation_y(
147                    movement1abs * 0.5 + movement2abs * 0.1,
148                ) * Quaternion::rotation_z(movement1abs * 0.2);
149
150                next.wing_bl.position = Vec3::new(-s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
151                next.wing_br.position = Vec3::new(s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
152                next.wing_bl.orientation =
153                    Quaternion::rotation_x(
154                        movement1abs * -0.2 + shortalt * 0.2 + movement2abs * -0.6,
155                    ) * Quaternion::rotation_y(movement1abs * -0.4 + movement2abs * -0.1);
156                next.wing_br.orientation =
157                    Quaternion::rotation_x(
158                        movement1abs * -0.2 + shortalt * 0.2 + movement2abs * -0.6,
159                    ) * Quaternion::rotation_y(movement1abs * 0.4 + movement2abs * 0.1);
160            },
161            Some(
162                "common.abilities.custom.arthropods.tarantula.leap"
163                | "common.abilities.custom.arthropods.hornbeetle.leap"
164                | "common.abilities.custom.arthropods.emberfly.leap",
165            ) => {
166                let pullback = 1.0 - move3base.powi(4);
167                let movement1abs = move1base * pullback;
168                let movement2abs = movementbase.powf(0.1) * pullback;
169                let movement3abs = move2base.powf(0.1) * pullback;
170                let early_pullback = 1.0 - move2base.powf(0.1);
171                let shortalt = (d.global_time * 80.0).sin() * movementbase * early_pullback;
172
173                next.chest.scale = Vec3::one() * s_a.scaler;
174
175                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
176                next.head.orientation =
177                    Quaternion::rotation_x(
178                        movement1abs * -0.2 + movement2abs * 0.4 + movement3abs * -1.0,
179                    ) * Quaternion::rotation_z((movement1abs * 4.0 * PI).sin() * 0.08);
180
181                next.chest.position =
182                    Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1abs * -2.0);
183                next.chest.orientation = Quaternion::rotation_x(movement2abs * 0.3)
184                    * Quaternion::rotation_z((movement1abs * 4.0 * PI).sin() * 0.08);
185
186                next.mandible_l.position =
187                    Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
188                next.mandible_r.position =
189                    Vec3::new(s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
190                next.mandible_l.orientation = Quaternion::rotation_x(
191                    (movement1abs * 4.0 * PI).sin() * 0.08
192                        + movement2abs * 0.3
193                        + movement3abs * -0.4,
194                );
195                next.mandible_r.orientation = Quaternion::rotation_x(
196                    (movement1abs * 4.0 * PI).sin() * 0.08
197                        + movement2abs * 0.3
198                        + movement3abs * -0.4,
199                );
200
201                next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
202                next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
203
204                next.wing_bl.position = Vec3::new(-s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
205                next.wing_br.position = Vec3::new(s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
206
207                next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
208                next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
209                next.leg_fl.orientation = Quaternion::rotation_x(
210                    movement1abs * 0.2 + movement2abs * 0.8 + movement3abs * -1.5,
211                ) * Quaternion::rotation_z(s_a.leg_ori.0);
212                next.leg_fr.orientation = Quaternion::rotation_x(
213                    movement1abs * 0.2 + movement2abs * 0.8 + movement3abs * -1.5,
214                ) * Quaternion::rotation_z(-s_a.leg_ori.0);
215
216                next.leg_fcl.position = Vec3::new(-s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
217                next.leg_fcr.position = Vec3::new(s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
218                next.leg_fcl.orientation = Quaternion::rotation_y(
219                    movement1abs * 0.2 + movement2abs * -1.0 + movement3abs * 0.8,
220                ) * Quaternion::rotation_z(s_a.leg_ori.1);
221                next.leg_fcr.orientation =
222                    Quaternion::rotation_y(movement1abs * -0.2 + movement2abs * 1.0)
223                        * Quaternion::rotation_z(-s_a.leg_ori.1);
224
225                next.leg_bcl.position = Vec3::new(-s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
226                next.leg_bcr.position = Vec3::new(s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
227                next.leg_bcl.orientation = Quaternion::rotation_y(
228                    movement1abs * 0.2 + movement2abs * -1.0 + movement3abs * 0.8,
229                ) * Quaternion::rotation_z(s_a.leg_ori.2);
230                next.leg_bcr.orientation =
231                    Quaternion::rotation_y(movement1abs * -0.2 + movement2abs * 1.0)
232                        * Quaternion::rotation_z(-s_a.leg_ori.2);
233
234                next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
235                next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
236                next.leg_bl.orientation = Quaternion::rotation_y(
237                    movement1abs * 0.2 + movement2abs * -1.0 + movement3abs * 0.8,
238                ) * Quaternion::rotation_z(s_a.leg_ori.3);
239                next.leg_br.orientation =
240                    Quaternion::rotation_y(movement1abs * -0.2 + movement2abs * 1.0)
241                        * Quaternion::rotation_z(-s_a.leg_ori.3);
242
243                next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
244                next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
245                next.wing_fl.orientation =
246                    Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * -0.2)
247                        * Quaternion::rotation_y(movement1abs * 0.5 + movement2abs * 0.1)
248                        * Quaternion::rotation_z(movement1abs * -0.2);
249                next.wing_fr.orientation =
250                    Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * -0.2)
251                        * Quaternion::rotation_y(movement1abs * -0.5 + movement2abs * -0.1)
252                        * Quaternion::rotation_z(movement1abs * 0.2);
253
254                next.wing_bl.position = Vec3::new(-s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
255                next.wing_br.position = Vec3::new(s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
256                next.wing_bl.orientation = Quaternion::rotation_x(
257                    (movement1abs * -0.2 + movement2abs * -0.6) * early_pullback,
258                ) * Quaternion::rotation_y(
259                    movement1abs * 0.4 + shortalt * 2.0 + movement2abs * 0.1,
260                ) * Quaternion::rotation_z(movement1abs * -1.4);
261                next.wing_br.orientation = Quaternion::rotation_x(
262                    (movement1abs * -0.2 + movement2abs * -0.6) * early_pullback,
263                ) * Quaternion::rotation_y(
264                    movement1abs * -0.4 + shortalt * 2.0 + movement2abs * -0.1,
265                ) * Quaternion::rotation_z(movement1abs * 1.4);
266            },
267            Some("common.abilities.custom.arthropods.dagonite.leapshockwave") => {
268                let pullback = 1.0 - move3base.powi(4);
269                let movement1abs = move1base * pullback;
270                let movement2abs = movementbase.powf(0.1) * pullback;
271                let movement3abs = move2base.powf(0.1) * pullback;
272                let early_pullback = 1.0 - move2base.powf(0.1);
273                let shortalt = (d.global_time * 80.0).sin() * movementbase * early_pullback;
274
275                next.chest.scale = Vec3::one() * s_a.scaler;
276
277                next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
278                next.head.orientation =
279                    Quaternion::rotation_x(
280                        movement1abs * -0.2 + movement2abs * 0.4 + movement3abs * -1.0,
281                    ) * Quaternion::rotation_z((movement1abs * 4.0 * PI).sin() * 0.08);
282
283                next.chest.position =
284                    Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1abs * -0.25);
285                next.chest.orientation = Quaternion::rotation_x(movement2abs * 0.15)
286                    * Quaternion::rotation_z((movement1abs * 4.0 * PI).sin() * 0.08);
287
288                next.mandible_l.position =
289                    Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
290                next.mandible_r.position =
291                    Vec3::new(s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
292                next.mandible_l.orientation = Quaternion::rotation_x(
293                    (movement1abs * 4.0 * PI).sin() * 0.08
294                        + movement2abs * 0.3
295                        + movement3abs * -0.4,
296                );
297                next.mandible_r.orientation = Quaternion::rotation_x(
298                    (movement1abs * 4.0 * PI).sin() * 0.08
299                        + movement2abs * 0.3
300                        + movement3abs * -0.4,
301                );
302
303                next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
304                next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
305
306                next.wing_bl.position = Vec3::new(-s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
307                next.wing_br.position = Vec3::new(s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
308
309                next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
310                next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
311                next.leg_fl.orientation = Quaternion::rotation_x(
312                    movement1abs * 0.2 + movement2abs * 0.8 + movement3abs * -1.5,
313                ) * Quaternion::rotation_z(s_a.leg_ori.0);
314                next.leg_fr.orientation = Quaternion::rotation_x(
315                    movement1abs * 0.2 + movement2abs * 0.8 + movement3abs * -1.5,
316                ) * Quaternion::rotation_z(-s_a.leg_ori.0);
317
318                next.leg_fcl.position = Vec3::new(-s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
319                next.leg_fcr.position = Vec3::new(s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
320                next.leg_fcl.orientation = Quaternion::rotation_y(
321                    movement1abs * 0.2 + movement2abs * -1.0 + movement3abs * 0.8,
322                ) * Quaternion::rotation_z(s_a.leg_ori.1);
323                next.leg_fcr.orientation =
324                    Quaternion::rotation_y(movement1abs * -0.2 + movement2abs * 1.0)
325                        * Quaternion::rotation_z(-s_a.leg_ori.1);
326
327                next.leg_bcl.position = Vec3::new(-s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
328                next.leg_bcr.position = Vec3::new(s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
329                next.leg_bcl.orientation = Quaternion::rotation_y(
330                    movement1abs * 0.2 + movement2abs * -1.0 + movement3abs * 0.8,
331                ) * Quaternion::rotation_z(s_a.leg_ori.2);
332                next.leg_bcr.orientation =
333                    Quaternion::rotation_y(movement1abs * -0.2 + movement2abs * 1.0)
334                        * Quaternion::rotation_z(-s_a.leg_ori.2);
335
336                next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
337                next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
338                next.leg_bl.orientation = Quaternion::rotation_y(
339                    movement1abs * 0.2 + movement2abs * -1.0 + movement3abs * 0.8,
340                ) * Quaternion::rotation_z(s_a.leg_ori.3);
341                next.leg_br.orientation =
342                    Quaternion::rotation_y(movement1abs * -0.2 + movement2abs * 1.0)
343                        * Quaternion::rotation_z(-s_a.leg_ori.3);
344
345                next.wing_fl.position = Vec3::new(-s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
346                next.wing_fr.position = Vec3::new(s_a.wing_f.0, s_a.wing_f.1, s_a.wing_f.2);
347                next.wing_fl.orientation =
348                    Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * -0.2)
349                        * Quaternion::rotation_y(movement1abs * 0.5 + movement2abs * 0.1)
350                        * Quaternion::rotation_z(movement1abs * -0.2);
351                next.wing_fr.orientation =
352                    Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * -0.2)
353                        * Quaternion::rotation_y(movement1abs * -0.5 + movement2abs * -0.1)
354                        * Quaternion::rotation_z(movement1abs * 0.2);
355
356                next.wing_bl.position = Vec3::new(-s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
357                next.wing_br.position = Vec3::new(s_a.wing_b.0, s_a.wing_b.1, s_a.wing_b.2);
358                next.wing_bl.orientation = Quaternion::rotation_x(
359                    (movement1abs * -0.2 + movement2abs * -0.6) * early_pullback,
360                ) * Quaternion::rotation_y(
361                    movement1abs * 0.4 + shortalt * 2.0 + movement2abs * 0.1,
362                ) * Quaternion::rotation_z(movement1abs * -1.4);
363                next.wing_br.orientation = Quaternion::rotation_x(
364                    (movement1abs * -0.2 + movement2abs * -0.6) * early_pullback,
365                ) * Quaternion::rotation_y(
366                    movement1abs * -0.4 + shortalt * 2.0 + movement2abs * -0.1,
367                ) * Quaternion::rotation_z(movement1abs * 1.4);
368            },
369            Some(
370                "common.abilities.custom.arthropods.tarantula.ensnaringwebs"
371                | "common.abilities.custom.arthropods.blackwidow.ensnaringwebs",
372            ) => {
373                let subtract = d.global_time - d.timer;
374                let check = subtract - subtract.trunc();
375                let mirror = (check - 0.5).signum();
376                let movement1abs = move1base.powi(2) * pullback;
377                let movement2abs = move2base.powi(4) * pullback;
378                let movement3abs = move3base * pullback;
379
380                next.chest.scale = Vec3::one() * s_a.scaler;
381                next.chest.orientation = Quaternion::rotation_x(movement2abs * 0.3)
382                    * Quaternion::rotation_z((movement1abs * 4.0 * PI).sin() * 0.02);
383
384                next.head.position = Vec3::new(
385                    0.0,
386                    s_a.head.0 + movement1abs * 3.0,
387                    s_a.head.1 + movement1abs * -3.0,
388                );
389                next.head.orientation =
390                    Quaternion::rotation_x(
391                        movement1abs * 1.5 + movement2abs * -1.5 + movement3abs * 0.8,
392                    ) * Quaternion::rotation_y(
393                        mirror * movement1abs * -0.2 + mirror * movement2abs * 0.2,
394                    ) * Quaternion::rotation_z((movement1abs * 4.0 * PI).sin() * 0.02);
395
396                next.chest.position = Vec3::new(
397                    0.0,
398                    s_a.chest.0,
399                    s_a.chest.1 + movement1abs * 7.0 + movement2abs * -2.0,
400                );
401                next.chest.orientation =
402                    Quaternion::rotation_x(movement1abs * -1.0 + movement2abs * 0.2);
403                next.mandible_l.position =
404                    Vec3::new(-s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
405                next.mandible_r.position =
406                    Vec3::new(s_a.mandible.0, s_a.mandible.1, s_a.mandible.2);
407                next.mandible_l.orientation = Quaternion::rotation_x(
408                    movement1abs * 0.5 + movement2abs * -1.5 + movement3abs * 0.8,
409                ) * Quaternion::rotation_z(
410                    movement1abs * 0.5 + movement2abs * -0.6 + movement3abs * 0.8,
411                );
412                next.mandible_r.orientation = Quaternion::rotation_x(
413                    movement1abs * 0.5 + movement2abs * -1.5 + movement3abs * 0.8,
414                ) * Quaternion::rotation_z(
415                    movement1abs * -0.5 + movement2abs * 0.6 + movement3abs * -0.8,
416                );
417
418                next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
419                next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
420                next.leg_fl.orientation =
421                    Quaternion::rotation_x(movement1abs * 1.0 + movement2abs * 0.2)
422                        * Quaternion::rotation_z(movement1abs * -0.2 + movement2abs * -0.2);
423                next.leg_fr.orientation =
424                    Quaternion::rotation_x(movement1abs * 1.0 + movement2abs * 0.2)
425                        * Quaternion::rotation_x(movement1abs * 0.2 + movement2abs * 0.2);
426
427                next.leg_fcl.position = Vec3::new(-s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
428                next.leg_fcr.position = Vec3::new(s_a.leg_fc.0, s_a.leg_fc.1, s_a.leg_fc.2);
429
430                next.leg_fcl.orientation =
431                    Quaternion::rotation_x(movement1abs * 1.3 + movement2abs * 0.3)
432                        * Quaternion::rotation_z(movement1abs * -0.5 + movement2abs * -0.2);
433                next.leg_fcr.orientation =
434                    Quaternion::rotation_x(movement1abs * 1.3 + movement2abs * 0.3)
435                        * Quaternion::rotation_z(movement1abs * 0.5 + movement2abs * -0.2);
436
437                next.leg_bcl.position = Vec3::new(-s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
438                next.leg_bcr.position = Vec3::new(s_a.leg_bc.0, s_a.leg_bc.1, s_a.leg_bc.2);
439
440                next.leg_bcl.orientation =
441                    Quaternion::rotation_x(movement1abs * 0.5 + movement2abs * 0.2);
442                next.leg_bcr.orientation =
443                    Quaternion::rotation_x(movement1abs * 0.5 + movement2abs * 0.2);
444
445                next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
446                next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
447
448                next.leg_bl.orientation =
449                    Quaternion::rotation_x(movement1abs * -0.5 + movement2abs * -0.2)
450                        * Quaternion::rotation_z(movement1abs * 0.8);
451                next.leg_br.orientation =
452                    Quaternion::rotation_x(movement1abs * -0.5 + movement2abs * -0.2)
453                        * Quaternion::rotation_z(movement1abs * -0.8);
454            },
455            _ => {},
456        }
457
458        next
459    }
460}