pub struct VehiclePhysics {Show 22 fields
pub body_id: u64,
pub wheels: Vec<WheelState>,
pub engine: EngineTorqueCurve,
pub gearbox: GearBox,
pub front_diff: Differential,
pub rear_diff: Differential,
pub center_diff: Option<Differential>,
pub wheelbase: f32,
pub track_width_front: f32,
pub track_width_rear: f32,
pub center_of_mass: Vec3,
pub mass: f32,
pub aerodynamic_drag: f32,
pub downforce_coefficient: f32,
pub brake_bias_front: f32,
pub abs_enabled: bool,
pub tcs_enabled: bool,
pub esc_enabled: bool,
pub throttle: f32,
pub brake: f32,
pub steering: f32,
pub handbrake: bool,
}Fields§
§body_id: u64§wheels: Vec<WheelState>§engine: EngineTorqueCurve§gearbox: GearBox§front_diff: Differential§rear_diff: Differential§center_diff: Option<Differential>§wheelbase: f32§track_width_front: f32§track_width_rear: f32§center_of_mass: Vec3§mass: f32§aerodynamic_drag: f32§downforce_coefficient: f32§brake_bias_front: f32§abs_enabled: bool§tcs_enabled: bool§esc_enabled: bool§throttle: f32§brake: f32§steering: f32§handbrake: boolImplementations§
Source§impl VehiclePhysics
impl VehiclePhysics
pub fn new(mass: f32, wheelbase: f32, track_width: f32) -> Self
pub fn apply_steering(&mut self)
Sourcepub fn aerodynamic_drag_force(&self, speed: f32) -> f32
pub fn aerodynamic_drag_force(&self, speed: f32) -> f32
Compute total aerodynamic drag force given vehicle speed (m/s)
Sourcepub fn abs_update(&mut self, vehicle_speed: f32)
pub fn abs_update(&mut self, vehicle_speed: f32)
ABS: prevent wheel lock-up
Sourcepub fn tcs_update(&mut self)
pub fn tcs_update(&mut self)
TCS: prevent wheel spin
pub fn update(&mut self, dt: f32, vehicle_speed: f32)
Trait Implementations§
Source§impl Clone for VehiclePhysics
impl Clone for VehiclePhysics
Auto Trait Implementations§
impl Freeze for VehiclePhysics
impl RefUnwindSafe for VehiclePhysics
impl Send for VehiclePhysics
impl Sync for VehiclePhysics
impl Unpin for VehiclePhysics
impl UnsafeUnpin for VehiclePhysics
impl UnwindSafe for VehiclePhysics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.