[−][src]Struct chip::Car
A car simulation.
Example
let mut car = Car::new(); car.set_pos(Point3::new(0.0, 0.0, 17.01)); car.set_vel(Vector3::new(300.0, 400.0, 500.0)); car.set_theta(Rotation3::identity()); car.set_on_ground(true); let input = Input { steer: 1.0, throttle: 1.0, ..Input::default() }; car.step(input, 1.0 / 120.0); println!("{:?}", car.pos());
Methods
impl Car
[src]
pub fn new() -> Self
[src]
Creates a Car
.
pub fn step(&mut self, input: Input, dt: f32)
[src]
Simulates the next dt
seconds, and updates the car's physics values.
pub fn pos(&self) -> Point3<f32>
[src]
Gets the car's position.
pub fn set_pos(&mut self, pos: Point3<f32>)
[src]
Sets the car's position.
pub fn vel(&self) -> Vector3<f32>
[src]
Gets the car's velocity.
pub fn set_vel(&mut self, vel: Vector3<f32>)
[src]
Sets the car's velocity.
pub fn omega(&self) -> Vector3<f32>
[src]
Gets the car's angular velocity.
pub fn set_omega(&mut self, omega: Vector3<f32>)
[src]
Sets the car's angular velocity.
pub fn theta(&self) -> Rotation3<f32>
[src]
Gets the car's rotation.
pub fn set_theta(&mut self, theta: Rotation3<f32>)
[src]
Sets the car's rotation.
pub fn on_ground(&self) -> bool
[src]
Gets whether the car's wheels are on the ground.
pub fn set_on_ground(&mut self, on_ground: bool)
[src]
Sets whether the car's wheels are on the ground.
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,