diff --git a/src/control/pid_controller.rs b/src/control/pid_controller.rs index d24cd3781..39fd350b7 100644 --- a/src/control/pid_controller.rs +++ b/src/control/pid_controller.rs @@ -10,6 +10,7 @@ use parry::math::AngVector; /// This is a [PID controller](https://en.wikipedia.org/wiki/Proportional%E2%80%93integral%E2%80%93derivative_controller) /// without the Integral part to keep the API immutable, while having a behaviour generally /// sufficient for games. +#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[derive(Debug, Copy, Clone, PartialEq)] pub struct PdController { /// The Proportional gain applied to the instantaneous linear position errors. @@ -51,6 +52,7 @@ impl Default for PdController { /// /// For video games, the Proportional-Derivative [`PdController`] is generally sufficient and /// offers an immutable API. +#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[derive(Debug, Copy, Clone, PartialEq)] pub struct PidController { /// The Proportional-Derivative (PD) part of this PID controller. diff --git a/src/control/ray_cast_vehicle_controller.rs b/src/control/ray_cast_vehicle_controller.rs index 2f1744214..c176e99ba 100644 --- a/src/control/ray_cast_vehicle_controller.rs +++ b/src/control/ray_cast_vehicle_controller.rs @@ -8,6 +8,8 @@ use crate::prelude::QueryPipelineMut; use crate::utils::{SimdCross, SimdDot}; /// A character controller to simulate vehicles using ray-casting for the wheels. +#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +#[derive(Clone, Debug)] pub struct DynamicRayCastVehicleController { wheels: Vec, forward_ws: Vec>, @@ -23,6 +25,7 @@ pub struct DynamicRayCastVehicleController { pub index_forward_axis: usize, } +#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[derive(Copy, Clone, Debug, PartialEq)] /// Parameters affecting the physical behavior of a wheel. pub struct WheelTuning { @@ -101,6 +104,7 @@ struct WheelDesc { pub side_friction_stiffness: Real, } +#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[derive(Copy, Clone, Debug, PartialEq)] /// A wheel attached to a vehicle. pub struct Wheel { @@ -225,6 +229,7 @@ impl Wheel { /// Information about suspension and the ground obtained from the ray-casting /// to simulate a wheel’s suspension. +#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] #[derive(Copy, Clone, Debug, PartialEq, Default)] pub struct RayCastInfo { /// The (world-space) contact normal between the wheel and the floor.