pub struct SpringCoefficients<N> {
pub natural_frequency: N,
pub damping_ratio: N,
}Expand description
Coefficients for a spring, typically used for configuring constraint softness for contacts and joints.
Fields§
§natural_frequency: NSets the natural frequency (Hz) of the spring-like constraint.
Higher values make the constraint stiffer and resolve constraint violations more quickly.
damping_ratio: NSets the damping ratio for the spring-like constraint.
Larger values make the joint more compliant (allowing more drift before stabilization).
Implementations§
Source§impl<N> SpringCoefficients<N>
impl<N> SpringCoefficients<N>
Sourcepub fn new(natural_frequency: N, damping_ratio: N) -> SpringCoefficients<N>
pub fn new(natural_frequency: N, damping_ratio: N) -> SpringCoefficients<N>
Initializes spring coefficients from the spring natural frequency and damping ratio.
Sourcepub fn contact_defaults() -> SpringCoefficients<N>
pub fn contact_defaults() -> SpringCoefficients<N>
Default softness coefficients for contacts (30 Hz, ζ = 10). The high ζ is load-bearing for large piles/stacks: softer contacts settle deeper under load, and the extra penetration keeps them wedging and creeping instead of resting.
Sourcepub fn contact_static_defaults() -> SpringCoefficients<N>
pub fn contact_static_defaults() -> SpringCoefficients<N>
Default softness coefficients for contacts touching a fixed body: twice the natural
frequency of Self::contact_defaults, holding piled/pushed
bodies more firmly against walls and floors so they are less likely to squeeze through.
Sourcepub fn joint_defaults() -> SpringCoefficients<N>
pub fn joint_defaults() -> SpringCoefficients<N>
Default softness coefficients for joints.
Sourcepub fn angular_frequency(&self) -> N
pub fn angular_frequency(&self) -> N
The contact’s spring angular frequency for constraints regularization.
Sourcepub fn erp_inv_dt(&self, dt: N) -> N
pub fn erp_inv_dt(&self, dt: N) -> N
The Self::erp coefficient, multiplied by the inverse timestep length.
Sourcepub fn erp(&self, dt: N) -> N
pub fn erp(&self, dt: N) -> N
The effective Error Reduction Parameter applied for calculating regularization forces.
This parameter is computed automatically from Self::natural_frequency,
Self::damping_ratio and the substep length.
Sourcepub fn cfm_coeff(&self, dt: N) -> N
pub fn cfm_coeff(&self, dt: N) -> N
Compute CFM assuming a critically damped spring multiplied by the damping ratio.
This coefficient softens the impulse applied at each solver iteration.
Sourcepub fn cfm_factor(&self, dt: N) -> N
pub fn cfm_factor(&self, dt: N) -> N
The CFM factor to be used in the constraint resolution.
This parameter is computed automatically from Self::natural_frequency,
Self::damping_ratio and the substep length.
Trait Implementations§
Source§impl<N> Clone for SpringCoefficients<N>where
N: Clone,
impl<N> Clone for SpringCoefficients<N>where
N: Clone,
Source§fn clone(&self) -> SpringCoefficients<N>
fn clone(&self) -> SpringCoefficients<N>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<N> Copy for SpringCoefficients<N>where
N: Copy,
Source§impl<N> Debug for SpringCoefficients<N>where
N: Debug,
impl<N> Debug for SpringCoefficients<N>where
N: Debug,
Source§impl<N> PartialEq for SpringCoefficients<N>where
N: PartialEq,
impl<N> PartialEq for SpringCoefficients<N>where
N: PartialEq,
impl<N> StructuralPartialEq for SpringCoefficients<N>where
N: PartialEq,
Auto Trait Implementations§
impl<N> Freeze for SpringCoefficients<N>where
N: Freeze,
impl<N> RefUnwindSafe for SpringCoefficients<N>where
N: RefUnwindSafe,
impl<N> Send for SpringCoefficients<N>where
N: Send,
impl<N> Sync for SpringCoefficients<N>where
N: Sync,
impl<N> Unpin for SpringCoefficients<N>where
N: Unpin,
impl<N> UnsafeUnpin for SpringCoefficients<N>where
N: UnsafeUnpin,
impl<N> UnwindSafe for SpringCoefficients<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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
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,
impl<T> ConditionalSend for Twhere
T: Send,
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>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
impl<T> MaybeSync for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
impl<T> Settings 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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
self.