1use crate::id::JointId;
8use crate::math_functions::{Quat, Vec3};
9
10use crate::recording::ops::RecOp;
11use crate::recording::session::Recording;
12
13impl Recording {
14 pub fn write_parallel_joint_set_spring_hertz(&mut self, joint: JointId, hertz: f32) {
16 self.begin_record(RecOp::ParallelJointSetSpringHertz as u8);
17 self.buffer.append_joint_id(joint);
18 self.buffer.append_f32(hertz);
19 self.end_record();
20 }
21
22 pub fn write_parallel_joint_set_spring_damping_ratio(
24 &mut self,
25 joint: JointId,
26 damping_ratio: f32,
27 ) {
28 self.begin_record(RecOp::ParallelJointSetSpringDampingRatio as u8);
29 self.buffer.append_joint_id(joint);
30 self.buffer.append_f32(damping_ratio);
31 self.end_record();
32 }
33
34 pub fn write_parallel_joint_set_max_torque(&mut self, joint: JointId, max_torque: f32) {
36 self.begin_record(RecOp::ParallelJointSetMaxTorque as u8);
37 self.buffer.append_joint_id(joint);
38 self.buffer.append_f32(max_torque);
39 self.end_record();
40 }
41
42 pub fn write_distance_joint_set_length(&mut self, joint: JointId, length: f32) {
44 self.begin_record(RecOp::DistanceJointSetLength as u8);
45 self.buffer.append_joint_id(joint);
46 self.buffer.append_f32(length);
47 self.end_record();
48 }
49
50 pub fn write_distance_joint_enable_spring(&mut self, joint: JointId, enable_spring: bool) {
52 self.begin_record(RecOp::DistanceJointEnableSpring as u8);
53 self.buffer.append_joint_id(joint);
54 self.buffer.append_bool(enable_spring);
55 self.end_record();
56 }
57
58 pub fn write_distance_joint_set_spring_force_range(
60 &mut self,
61 joint: JointId,
62 lower_force: f32,
63 upper_force: f32,
64 ) {
65 self.begin_record(RecOp::DistanceJointSetSpringForceRange as u8);
66 self.buffer.append_joint_id(joint);
67 self.buffer.append_f32(lower_force);
68 self.buffer.append_f32(upper_force);
69 self.end_record();
70 }
71
72 pub fn write_distance_joint_set_spring_hertz(&mut self, joint: JointId, hertz: f32) {
74 self.begin_record(RecOp::DistanceJointSetSpringHertz as u8);
75 self.buffer.append_joint_id(joint);
76 self.buffer.append_f32(hertz);
77 self.end_record();
78 }
79
80 pub fn write_distance_joint_set_spring_damping_ratio(
82 &mut self,
83 joint: JointId,
84 damping_ratio: f32,
85 ) {
86 self.begin_record(RecOp::DistanceJointSetSpringDampingRatio as u8);
87 self.buffer.append_joint_id(joint);
88 self.buffer.append_f32(damping_ratio);
89 self.end_record();
90 }
91
92 pub fn write_distance_joint_enable_limit(&mut self, joint: JointId, enable_limit: bool) {
94 self.begin_record(RecOp::DistanceJointEnableLimit as u8);
95 self.buffer.append_joint_id(joint);
96 self.buffer.append_bool(enable_limit);
97 self.end_record();
98 }
99
100 pub fn write_distance_joint_set_length_range(
102 &mut self,
103 joint: JointId,
104 min_length: f32,
105 max_length: f32,
106 ) {
107 self.begin_record(RecOp::DistanceJointSetLengthRange as u8);
108 self.buffer.append_joint_id(joint);
109 self.buffer.append_f32(min_length);
110 self.buffer.append_f32(max_length);
111 self.end_record();
112 }
113
114 pub fn write_distance_joint_enable_motor(&mut self, joint: JointId, enable_motor: bool) {
116 self.begin_record(RecOp::DistanceJointEnableMotor as u8);
117 self.buffer.append_joint_id(joint);
118 self.buffer.append_bool(enable_motor);
119 self.end_record();
120 }
121
122 pub fn write_distance_joint_set_motor_speed(&mut self, joint: JointId, motor_speed: f32) {
124 self.begin_record(RecOp::DistanceJointSetMotorSpeed as u8);
125 self.buffer.append_joint_id(joint);
126 self.buffer.append_f32(motor_speed);
127 self.end_record();
128 }
129
130 pub fn write_distance_joint_set_max_motor_force(&mut self, joint: JointId, force: f32) {
132 self.begin_record(RecOp::DistanceJointSetMaxMotorForce as u8);
133 self.buffer.append_joint_id(joint);
134 self.buffer.append_f32(force);
135 self.end_record();
136 }
137
138 pub fn write_motor_joint_set_linear_velocity(&mut self, joint: JointId, velocity: Vec3) {
140 self.begin_record(RecOp::MotorJointSetLinearVelocity as u8);
141 self.buffer.append_joint_id(joint);
142 self.buffer.append_vec3(velocity);
143 self.end_record();
144 }
145
146 pub fn write_motor_joint_set_angular_velocity(&mut self, joint: JointId, velocity: Vec3) {
148 self.begin_record(RecOp::MotorJointSetAngularVelocity as u8);
149 self.buffer.append_joint_id(joint);
150 self.buffer.append_vec3(velocity);
151 self.end_record();
152 }
153
154 pub fn write_motor_joint_set_max_velocity_force(&mut self, joint: JointId, max_force: f32) {
156 self.begin_record(RecOp::MotorJointSetMaxVelocityForce as u8);
157 self.buffer.append_joint_id(joint);
158 self.buffer.append_f32(max_force);
159 self.end_record();
160 }
161
162 pub fn write_motor_joint_set_max_velocity_torque(&mut self, joint: JointId, max_torque: f32) {
164 self.begin_record(RecOp::MotorJointSetMaxVelocityTorque as u8);
165 self.buffer.append_joint_id(joint);
166 self.buffer.append_f32(max_torque);
167 self.end_record();
168 }
169
170 pub fn write_motor_joint_set_linear_hertz(&mut self, joint: JointId, hertz: f32) {
172 self.begin_record(RecOp::MotorJointSetLinearHertz as u8);
173 self.buffer.append_joint_id(joint);
174 self.buffer.append_f32(hertz);
175 self.end_record();
176 }
177
178 pub fn write_motor_joint_set_linear_damping_ratio(&mut self, joint: JointId, damping: f32) {
180 self.begin_record(RecOp::MotorJointSetLinearDampingRatio as u8);
181 self.buffer.append_joint_id(joint);
182 self.buffer.append_f32(damping);
183 self.end_record();
184 }
185
186 pub fn write_motor_joint_set_angular_hertz(&mut self, joint: JointId, hertz: f32) {
188 self.begin_record(RecOp::MotorJointSetAngularHertz as u8);
189 self.buffer.append_joint_id(joint);
190 self.buffer.append_f32(hertz);
191 self.end_record();
192 }
193
194 pub fn write_motor_joint_set_angular_damping_ratio(&mut self, joint: JointId, damping: f32) {
196 self.begin_record(RecOp::MotorJointSetAngularDampingRatio as u8);
197 self.buffer.append_joint_id(joint);
198 self.buffer.append_f32(damping);
199 self.end_record();
200 }
201
202 pub fn write_motor_joint_set_max_spring_force(&mut self, joint: JointId, max_force: f32) {
204 self.begin_record(RecOp::MotorJointSetMaxSpringForce as u8);
205 self.buffer.append_joint_id(joint);
206 self.buffer.append_f32(max_force);
207 self.end_record();
208 }
209
210 pub fn write_motor_joint_set_max_spring_torque(&mut self, joint: JointId, max_torque: f32) {
212 self.begin_record(RecOp::MotorJointSetMaxSpringTorque as u8);
213 self.buffer.append_joint_id(joint);
214 self.buffer.append_f32(max_torque);
215 self.end_record();
216 }
217
218 pub fn write_prismatic_joint_enable_spring(&mut self, joint: JointId, enable_spring: bool) {
220 self.begin_record(RecOp::PrismaticJointEnableSpring as u8);
221 self.buffer.append_joint_id(joint);
222 self.buffer.append_bool(enable_spring);
223 self.end_record();
224 }
225
226 pub fn write_prismatic_joint_set_spring_hertz(&mut self, joint: JointId, hertz: f32) {
228 self.begin_record(RecOp::PrismaticJointSetSpringHertz as u8);
229 self.buffer.append_joint_id(joint);
230 self.buffer.append_f32(hertz);
231 self.end_record();
232 }
233
234 pub fn write_prismatic_joint_set_spring_damping_ratio(
236 &mut self,
237 joint: JointId,
238 damping_ratio: f32,
239 ) {
240 self.begin_record(RecOp::PrismaticJointSetSpringDampingRatio as u8);
241 self.buffer.append_joint_id(joint);
242 self.buffer.append_f32(damping_ratio);
243 self.end_record();
244 }
245
246 pub fn write_prismatic_joint_set_target_translation(
248 &mut self,
249 joint: JointId,
250 translation: f32,
251 ) {
252 self.begin_record(RecOp::PrismaticJointSetTargetTranslation as u8);
253 self.buffer.append_joint_id(joint);
254 self.buffer.append_f32(translation);
255 self.end_record();
256 }
257
258 pub fn write_prismatic_joint_enable_limit(&mut self, joint: JointId, enable_limit: bool) {
260 self.begin_record(RecOp::PrismaticJointEnableLimit as u8);
261 self.buffer.append_joint_id(joint);
262 self.buffer.append_bool(enable_limit);
263 self.end_record();
264 }
265
266 pub fn write_prismatic_joint_set_limits(&mut self, joint: JointId, lower: f32, upper: f32) {
268 self.begin_record(RecOp::PrismaticJointSetLimits as u8);
269 self.buffer.append_joint_id(joint);
270 self.buffer.append_f32(lower);
271 self.buffer.append_f32(upper);
272 self.end_record();
273 }
274
275 pub fn write_prismatic_joint_enable_motor(&mut self, joint: JointId, enable_motor: bool) {
277 self.begin_record(RecOp::PrismaticJointEnableMotor as u8);
278 self.buffer.append_joint_id(joint);
279 self.buffer.append_bool(enable_motor);
280 self.end_record();
281 }
282
283 pub fn write_prismatic_joint_set_motor_speed(&mut self, joint: JointId, motor_speed: f32) {
285 self.begin_record(RecOp::PrismaticJointSetMotorSpeed as u8);
286 self.buffer.append_joint_id(joint);
287 self.buffer.append_f32(motor_speed);
288 self.end_record();
289 }
290
291 pub fn write_prismatic_joint_set_max_motor_force(&mut self, joint: JointId, force: f32) {
293 self.begin_record(RecOp::PrismaticJointSetMaxMotorForce as u8);
294 self.buffer.append_joint_id(joint);
295 self.buffer.append_f32(force);
296 self.end_record();
297 }
298
299 pub fn write_revolute_joint_enable_spring(&mut self, joint: JointId, enable_spring: bool) {
301 self.begin_record(RecOp::RevoluteJointEnableSpring as u8);
302 self.buffer.append_joint_id(joint);
303 self.buffer.append_bool(enable_spring);
304 self.end_record();
305 }
306
307 pub fn write_revolute_joint_set_spring_hertz(&mut self, joint: JointId, hertz: f32) {
309 self.begin_record(RecOp::RevoluteJointSetSpringHertz as u8);
310 self.buffer.append_joint_id(joint);
311 self.buffer.append_f32(hertz);
312 self.end_record();
313 }
314
315 pub fn write_revolute_joint_set_spring_damping_ratio(
317 &mut self,
318 joint: JointId,
319 damping_ratio: f32,
320 ) {
321 self.begin_record(RecOp::RevoluteJointSetSpringDampingRatio as u8);
322 self.buffer.append_joint_id(joint);
323 self.buffer.append_f32(damping_ratio);
324 self.end_record();
325 }
326
327 pub fn write_revolute_joint_set_target_angle(&mut self, joint: JointId, angle: f32) {
329 self.begin_record(RecOp::RevoluteJointSetTargetAngle as u8);
330 self.buffer.append_joint_id(joint);
331 self.buffer.append_f32(angle);
332 self.end_record();
333 }
334
335 pub fn write_revolute_joint_enable_limit(&mut self, joint: JointId, enable_limit: bool) {
337 self.begin_record(RecOp::RevoluteJointEnableLimit as u8);
338 self.buffer.append_joint_id(joint);
339 self.buffer.append_bool(enable_limit);
340 self.end_record();
341 }
342
343 pub fn write_revolute_joint_set_limits(&mut self, joint: JointId, lower: f32, upper: f32) {
345 self.begin_record(RecOp::RevoluteJointSetLimits as u8);
346 self.buffer.append_joint_id(joint);
347 self.buffer.append_f32(lower);
348 self.buffer.append_f32(upper);
349 self.end_record();
350 }
351
352 pub fn write_revolute_joint_enable_motor(&mut self, joint: JointId, enable_motor: bool) {
354 self.begin_record(RecOp::RevoluteJointEnableMotor as u8);
355 self.buffer.append_joint_id(joint);
356 self.buffer.append_bool(enable_motor);
357 self.end_record();
358 }
359
360 pub fn write_revolute_joint_set_motor_speed(&mut self, joint: JointId, motor_speed: f32) {
362 self.begin_record(RecOp::RevoluteJointSetMotorSpeed as u8);
363 self.buffer.append_joint_id(joint);
364 self.buffer.append_f32(motor_speed);
365 self.end_record();
366 }
367
368 pub fn write_revolute_joint_set_max_motor_torque(&mut self, joint: JointId, torque: f32) {
370 self.begin_record(RecOp::RevoluteJointSetMaxMotorTorque as u8);
371 self.buffer.append_joint_id(joint);
372 self.buffer.append_f32(torque);
373 self.end_record();
374 }
375
376 pub fn write_spherical_joint_enable_cone_limit(&mut self, joint: JointId, enable_limit: bool) {
378 self.begin_record(RecOp::SphericalJointEnableConeLimit as u8);
379 self.buffer.append_joint_id(joint);
380 self.buffer.append_bool(enable_limit);
381 self.end_record();
382 }
383
384 pub fn write_spherical_joint_set_cone_limit(&mut self, joint: JointId, angle_radians: f32) {
386 self.begin_record(RecOp::SphericalJointSetConeLimit as u8);
387 self.buffer.append_joint_id(joint);
388 self.buffer.append_f32(angle_radians);
389 self.end_record();
390 }
391
392 pub fn write_spherical_joint_enable_twist_limit(&mut self, joint: JointId, enable_limit: bool) {
394 self.begin_record(RecOp::SphericalJointEnableTwistLimit as u8);
395 self.buffer.append_joint_id(joint);
396 self.buffer.append_bool(enable_limit);
397 self.end_record();
398 }
399
400 pub fn write_spherical_joint_set_twist_limits(
402 &mut self,
403 joint: JointId,
404 lower: f32,
405 upper: f32,
406 ) {
407 self.begin_record(RecOp::SphericalJointSetTwistLimits as u8);
408 self.buffer.append_joint_id(joint);
409 self.buffer.append_f32(lower);
410 self.buffer.append_f32(upper);
411 self.end_record();
412 }
413
414 pub fn write_spherical_joint_enable_spring(&mut self, joint: JointId, enable_spring: bool) {
416 self.begin_record(RecOp::SphericalJointEnableSpring as u8);
417 self.buffer.append_joint_id(joint);
418 self.buffer.append_bool(enable_spring);
419 self.end_record();
420 }
421
422 pub fn write_spherical_joint_set_spring_hertz(&mut self, joint: JointId, hertz: f32) {
424 self.begin_record(RecOp::SphericalJointSetSpringHertz as u8);
425 self.buffer.append_joint_id(joint);
426 self.buffer.append_f32(hertz);
427 self.end_record();
428 }
429
430 pub fn write_spherical_joint_set_spring_damping_ratio(
432 &mut self,
433 joint: JointId,
434 damping_ratio: f32,
435 ) {
436 self.begin_record(RecOp::SphericalJointSetSpringDampingRatio as u8);
437 self.buffer.append_joint_id(joint);
438 self.buffer.append_f32(damping_ratio);
439 self.end_record();
440 }
441
442 pub fn write_spherical_joint_set_target_rotation(
444 &mut self,
445 joint: JointId,
446 target_rotation: Quat,
447 ) {
448 self.begin_record(RecOp::SphericalJointSetTargetRotation as u8);
449 self.buffer.append_joint_id(joint);
450 self.buffer.append_quat(target_rotation);
451 self.end_record();
452 }
453
454 pub fn write_spherical_joint_enable_motor(&mut self, joint: JointId, enable_motor: bool) {
456 self.begin_record(RecOp::SphericalJointEnableMotor as u8);
457 self.buffer.append_joint_id(joint);
458 self.buffer.append_bool(enable_motor);
459 self.end_record();
460 }
461
462 pub fn write_spherical_joint_set_motor_velocity(
464 &mut self,
465 joint: JointId,
466 motor_velocity: Vec3,
467 ) {
468 self.begin_record(RecOp::SphericalJointSetMotorVelocity as u8);
469 self.buffer.append_joint_id(joint);
470 self.buffer.append_vec3(motor_velocity);
471 self.end_record();
472 }
473
474 pub fn write_spherical_joint_set_max_motor_torque(&mut self, joint: JointId, torque: f32) {
476 self.begin_record(RecOp::SphericalJointSetMaxMotorTorque as u8);
477 self.buffer.append_joint_id(joint);
478 self.buffer.append_f32(torque);
479 self.end_record();
480 }
481
482 pub fn write_weld_joint_set_linear_hertz(&mut self, joint: JointId, hertz: f32) {
484 self.begin_record(RecOp::WeldJointSetLinearHertz as u8);
485 self.buffer.append_joint_id(joint);
486 self.buffer.append_f32(hertz);
487 self.end_record();
488 }
489
490 pub fn write_weld_joint_set_linear_damping_ratio(
492 &mut self,
493 joint: JointId,
494 damping_ratio: f32,
495 ) {
496 self.begin_record(RecOp::WeldJointSetLinearDampingRatio as u8);
497 self.buffer.append_joint_id(joint);
498 self.buffer.append_f32(damping_ratio);
499 self.end_record();
500 }
501
502 pub fn write_weld_joint_set_angular_hertz(&mut self, joint: JointId, hertz: f32) {
504 self.begin_record(RecOp::WeldJointSetAngularHertz as u8);
505 self.buffer.append_joint_id(joint);
506 self.buffer.append_f32(hertz);
507 self.end_record();
508 }
509
510 pub fn write_weld_joint_set_angular_damping_ratio(
512 &mut self,
513 joint: JointId,
514 damping_ratio: f32,
515 ) {
516 self.begin_record(RecOp::WeldJointSetAngularDampingRatio as u8);
517 self.buffer.append_joint_id(joint);
518 self.buffer.append_f32(damping_ratio);
519 self.end_record();
520 }
521
522 pub fn write_wheel_joint_enable_suspension(&mut self, joint: JointId, flag: bool) {
524 self.begin_record(RecOp::WheelJointEnableSuspension as u8);
525 self.buffer.append_joint_id(joint);
526 self.buffer.append_bool(flag);
527 self.end_record();
528 }
529
530 pub fn write_wheel_joint_set_suspension_hertz(&mut self, joint: JointId, hertz: f32) {
532 self.begin_record(RecOp::WheelJointSetSuspensionHertz as u8);
533 self.buffer.append_joint_id(joint);
534 self.buffer.append_f32(hertz);
535 self.end_record();
536 }
537
538 pub fn write_wheel_joint_set_suspension_damping_ratio(
540 &mut self,
541 joint: JointId,
542 damping_ratio: f32,
543 ) {
544 self.begin_record(RecOp::WheelJointSetSuspensionDampingRatio as u8);
545 self.buffer.append_joint_id(joint);
546 self.buffer.append_f32(damping_ratio);
547 self.end_record();
548 }
549
550 pub fn write_wheel_joint_enable_suspension_limit(&mut self, joint: JointId, flag: bool) {
552 self.begin_record(RecOp::WheelJointEnableSuspensionLimit as u8);
553 self.buffer.append_joint_id(joint);
554 self.buffer.append_bool(flag);
555 self.end_record();
556 }
557
558 pub fn write_wheel_joint_set_suspension_limits(
560 &mut self,
561 joint: JointId,
562 lower: f32,
563 upper: f32,
564 ) {
565 self.begin_record(RecOp::WheelJointSetSuspensionLimits as u8);
566 self.buffer.append_joint_id(joint);
567 self.buffer.append_f32(lower);
568 self.buffer.append_f32(upper);
569 self.end_record();
570 }
571
572 pub fn write_wheel_joint_enable_spin_motor(&mut self, joint: JointId, flag: bool) {
574 self.begin_record(RecOp::WheelJointEnableSpinMotor as u8);
575 self.buffer.append_joint_id(joint);
576 self.buffer.append_bool(flag);
577 self.end_record();
578 }
579
580 pub fn write_wheel_joint_set_spin_motor_speed(&mut self, joint: JointId, speed: f32) {
582 self.begin_record(RecOp::WheelJointSetSpinMotorSpeed as u8);
583 self.buffer.append_joint_id(joint);
584 self.buffer.append_f32(speed);
585 self.end_record();
586 }
587
588 pub fn write_wheel_joint_set_max_spin_torque(&mut self, joint: JointId, torque: f32) {
590 self.begin_record(RecOp::WheelJointSetMaxSpinTorque as u8);
591 self.buffer.append_joint_id(joint);
592 self.buffer.append_f32(torque);
593 self.end_record();
594 }
595
596 pub fn write_wheel_joint_enable_steering(&mut self, joint: JointId, flag: bool) {
598 self.begin_record(RecOp::WheelJointEnableSteering as u8);
599 self.buffer.append_joint_id(joint);
600 self.buffer.append_bool(flag);
601 self.end_record();
602 }
603
604 pub fn write_wheel_joint_set_steering_hertz(&mut self, joint: JointId, hertz: f32) {
606 self.begin_record(RecOp::WheelJointSetSteeringHertz as u8);
607 self.buffer.append_joint_id(joint);
608 self.buffer.append_f32(hertz);
609 self.end_record();
610 }
611
612 pub fn write_wheel_joint_set_steering_damping_ratio(
614 &mut self,
615 joint: JointId,
616 damping_ratio: f32,
617 ) {
618 self.begin_record(RecOp::WheelJointSetSteeringDampingRatio as u8);
619 self.buffer.append_joint_id(joint);
620 self.buffer.append_f32(damping_ratio);
621 self.end_record();
622 }
623
624 pub fn write_wheel_joint_set_max_steering_torque(&mut self, joint: JointId, torque: f32) {
626 self.begin_record(RecOp::WheelJointSetMaxSteeringTorque as u8);
627 self.buffer.append_joint_id(joint);
628 self.buffer.append_f32(torque);
629 self.end_record();
630 }
631
632 pub fn write_wheel_joint_enable_steering_limit(&mut self, joint: JointId, flag: bool) {
634 self.begin_record(RecOp::WheelJointEnableSteeringLimit as u8);
635 self.buffer.append_joint_id(joint);
636 self.buffer.append_bool(flag);
637 self.end_record();
638 }
639
640 pub fn write_wheel_joint_set_steering_limits(
642 &mut self,
643 joint: JointId,
644 lower: f32,
645 upper: f32,
646 ) {
647 self.begin_record(RecOp::WheelJointSetSteeringLimits as u8);
648 self.buffer.append_joint_id(joint);
649 self.buffer.append_f32(lower);
650 self.buffer.append_f32(upper);
651 self.end_record();
652 }
653
654 pub fn write_wheel_joint_set_target_steering_angle(&mut self, joint: JointId, radians: f32) {
656 self.begin_record(RecOp::WheelJointSetTargetSteeringAngle as u8);
657 self.buffer.append_joint_id(joint);
658 self.buffer.append_f32(radians);
659 self.end_record();
660 }
661}