pub struct ConstraintSolver {
pub iterations: usize,
pub baumgarte: f32,
pub slop: f32,
pub warm_start_factor: f32,
pub restitution_velocity_threshold: f32,
pub max_linear_correction: f32,
pub split_impulse_enabled: bool,
pub split_impulse_erp: f32,
}Fields§
§iterations: usizePGS iterasyon sayısı (daha fazla = daha stabil, daha yavaş)
baumgarte: f32Baumgarte stabilizasyon faktörü (0.1..0.3 arası ideal) Split Impulse kapalıyken fallback olarak kullanılır.
slop: f32Penetrasyon toleransı — bu kadar penetrasyon normal kabul edilir
warm_start_factor: f32Warm-start faktörü (0.8 = önceki frame impulsunun %80’ini uygula)
restitution_velocity_threshold: f32Bu hızın altındaki çarpışmalarda restitution sıfır yapılır (dinlenme teması)
max_linear_correction: f32Maksimum pozisyon düzeltme miktarı (metre/step) - Patlamaları önler
split_impulse_enabled: boolSplit Impulse (Pseudo-Velocity) — pozisyon düzeltmesini ayrı bir pseudo-velocity kanalında yapar, velocity’yi kirletmez. Stacking stabilitesi ve resting contact jitter’ını önler.
split_impulse_erp: f32Split Impulse penetrasyon düzeltme oranı (0.1..0.4 arası ideal)
Implementations§
Source§impl ConstraintSolver
impl ConstraintSolver
pub fn new(iterations: usize) -> Self
pub fn solve_contacts( &self, manifolds: &mut [ContactManifold], rigid_bodies: &[RigidBody], transforms: &[Transform], velocities: &mut [Velocity], entity_index_map: &HashMap<u32, usize>, dt: f32, )
pub fn solve_contact_constraint( &self, rb_a: &mut RigidBody, transform_a: &Transform, vel_a: &mut Velocity, rb_b: &mut RigidBody, transform_b: &Transform, vel_b: &mut Velocity, contact_point: Vec3, normal: Vec3, penetration: f32, static_friction: f32, dynamic_friction: f32, restitution: f32, dt: f32, )
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConstraintSolver
impl RefUnwindSafe for ConstraintSolver
impl Send for ConstraintSolver
impl Sync for ConstraintSolver
impl Unpin for ConstraintSolver
impl UnsafeUnpin for ConstraintSolver
impl UnwindSafe for ConstraintSolver
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> 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>
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 more