Skip to main content

PhysicsConfig

Type Alias PhysicsConfig 

Source
pub type PhysicsConfig = SolverConfig;
Expand description

Physics configuration (alias for SolverConfig)

Aliased Type§

pub struct PhysicsConfig {
    pub substeps: usize,
    pub iterations: usize,
    pub gravity: Vec3Fix,
    pub damping: Fix128,
    pub warm_start_factor: Fix128,
    pub solver_backend: SolverBackend,
}

Fields§

§substeps: usize

Number of substeps per frame

§iterations: usize

Number of constraint solver passes per substep (default 1 since 1.2.0, Small Steps: prefer more substeps over more iterations)

§gravity: Vec3Fix

Gravity vector

§damping: Fix128

Global velocity-retention factor, applied once per frame (step()), independent of substeps (1.0 = no damping). Before 1.2.0 it was applied per substep, which made the result depend on substeps.

§warm_start_factor: Fix128

No effect since 1.2.0 (kept for struct compatibility).

Distance constraints follow standard XPBD (lambda = 0 at substep start, accumulated over iterations) and contacts are re-detected every substep and accumulate their multiplier within it, so there is no previous-substep multiplier left to warm-start from. Before 1.2.0 the factor biased both solvers and was the source of the iteration-dependent stiffness (distance) and the energy-creating re-push (contact). 0.8〜0.95 が安定的。デフォルト 0.85。

§solver_backend: SolverBackend

Which integrator PhysicsWorld::step dispatches to. Default SolverBackend::Xpbd — selecting it is structurally a no-op (the TGS dispatch branch is behind a runtime matches! check that is never taken), so every existing caller that does not set this field keeps today’s step behavior bit-for-bit. See SolverBackend for the Tgs path’s documented gaps.