pub struct PhysicsConfig {
pub gravity: f64,
pub time_step: f64,
pub max_simulation_time: f64,
pub rest_velocity_threshold: f64,
pub convergence_threshold: f64,
pub friction: f64,
pub restitution: f64,
pub solver_iterations: usize,
pub enable_shaking: bool,
pub shake_amplitude: f64,
pub shake_frequency: f64,
}Expand description
Configuration for physics simulation.
Fields§
§gravity: f64Gravity acceleration (m/s², negative for downward).
time_step: f64Simulation time step (seconds).
max_simulation_time: f64Maximum simulation time (seconds).
rest_velocity_threshold: f64Velocity threshold for considering a box at rest.
convergence_threshold: f64Position change threshold for convergence.
friction: f64Friction coefficient (0.0-1.0).
restitution: f64Restitution coefficient (bounciness, 0.0-1.0).
solver_iterations: usizeNumber of iterations for constraint solving.
enable_shaking: boolEnable shaking compaction.
shake_amplitude: f64Shaking amplitude (if enabled).
shake_frequency: f64Shaking frequency (Hz, if enabled).
Implementations§
Source§impl PhysicsConfig
impl PhysicsConfig
Sourcepub fn with_gravity(self, gravity: f64) -> Self
pub fn with_gravity(self, gravity: f64) -> Self
Sets the gravity (negative for downward).
Sourcepub fn with_time_step(self, dt: f64) -> Self
pub fn with_time_step(self, dt: f64) -> Self
Sets the simulation time step.
Sourcepub fn with_max_time(self, max_time: f64) -> Self
pub fn with_max_time(self, max_time: f64) -> Self
Sets the maximum simulation time.
Sourcepub fn with_friction(self, friction: f64) -> Self
pub fn with_friction(self, friction: f64) -> Self
Sets the friction coefficient.
Sourcepub fn with_restitution(self, restitution: f64) -> Self
pub fn with_restitution(self, restitution: f64) -> Self
Sets the restitution (bounciness).
Sourcepub fn with_shaking(self, amplitude: f64, frequency: f64) -> Self
pub fn with_shaking(self, amplitude: f64, frequency: f64) -> Self
Enables shaking compaction.
Trait Implementations§
Source§impl Clone for PhysicsConfig
impl Clone for PhysicsConfig
Source§fn clone(&self) -> PhysicsConfig
fn clone(&self) -> PhysicsConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PhysicsConfig
impl Debug for PhysicsConfig
Auto Trait Implementations§
impl Freeze for PhysicsConfig
impl RefUnwindSafe for PhysicsConfig
impl Send for PhysicsConfig
impl Sync for PhysicsConfig
impl Unpin for PhysicsConfig
impl UnwindSafe for PhysicsConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.