Enum heron::rapier_plugin::rapier::dynamics::SpringModel[]

pub enum SpringModel {
    Disabled,
    VelocityBased,
    AccelerationBased,
    ForceBased,
}

The spring-like model used for constraints resolution.

Variants

Disabled

No equation is solved.

VelocityBased

The solved spring-like equation is: delta_velocity(t + dt) = stiffness / dt * (target_pos - pos(t)) + damping * (target_vel - vel(t))

Here the stiffness is the ratio of position error to be solved at each timestep (like a velocity-based ERP), and the damping is the ratio of velocity error to be solved at each timestep.

AccelerationBased

The solved spring-like equation is: acceleration(t + dt) = stiffness * (target_pos - pos(t)) + damping * (target_vel - vel(t))

ForceBased

The solved spring-like equation is: force(t + dt) = stiffness * (target_pos - pos(t + dt)) + damping * (target_vel - vel(t + dt))

Implementations

impl SpringModel

pub fn combine_coefficients(
    self,
    dt: f32,
    stiffness: f32,
    damping: f32
) -> (f32, f32, f32, bool)

Combines the coefficients used for solving the spring equation.

Returns the new coefficients (stiffness, damping, inv_lhs_scale, keep_inv_lhs) coefficients for the equivalent impulse-based equation. These new coefficients must be used in the following way:

  • rhs = (stiffness * pos_err + damping * vel_err) / gamma.
  • new_inv_lhs = gamma * if keep_inv_lhs { inv_lhs } else { 1.0 }. Note that the returned gamma will be zero if both stiffness and damping are zero.

Trait Implementations

impl Clone for SpringModel

impl Copy for SpringModel

impl Debug for SpringModel

impl Default for SpringModel

impl Eq for SpringModel

impl PartialEq<SpringModel> for SpringModel

impl StructuralEq for SpringModel

impl StructuralPartialEq for SpringModel

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Any + Clone

impl<T> Component for T where
    T: 'static + Send + Sync

impl<T> Downcast for T where
    T: Any

impl<T> Downcast<T> for T

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> DynEq for T where
    T: Any + Eq

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FromWorld for T where
    T: Default

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: Copy + PartialEq<T> + Debug + Any
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> TypeData for T where
    T: 'static + Send + Sync + Clone

impl<T> Upcast<T> for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,