#[non_exhaustive]pub enum SolverBackend {
Xpbd,
Tgs,
}Expand description
Selects which rigid-body integrator PhysicsWorld::step dispatches to.
Both variants read and write the same RigidBody fields, so a world
can be migrated between backends between steps without changing any
other configuration. They are not numerically interchangeable —
XPBD is position-based (Macklin/Müller) and TGS is a sub-stepping
impulse-based projected Gauss-Seidel integrator (Müller et al. 2020,
see the crate-internal solver_tgs module) — so the same scene produces different
(both physically valid) trajectories under each backend. Pick one and
stay on it for a given simulation; do not expect bit-identical replay
across a backend switch.
§Notes on the Tgs path
DistanceConstraints are enforced as bilateral velocity-level impulse
joints (JointOriented in solver_tgs_hooks_6dof_oriented), solved
every TGS inner sub-step alongside contacts, plus a Baumgarte position
correction for residual drift — a genuinely different algorithm from
XPBD’s position-based compliance solve, so the two backends converge to
slightly different equilibria for the same scene (not a bug; see
tests/analytic_tgs_wiring.rs‘s joint tests for both backends’ measured
bands).
Pre-solve hooks and contact modifiers run once over the
tick’s contacts before the solve (tests/analytic_tgs_backend_coverage.rs).
The world’s Joints are solved inside the TGS substep loop: after each
substep’s impulse solve, the same position-level joint projection the XPBD
substep runs is applied and its correction is added to the bodies’ linear
and angular velocities (tests/analytic_tgs_joints_in_substep.rs).
- Requires the
stdfeature (solver_tgsisstd-gated, same as the rest of the TGS family). SelectingTgsin a build withoutstdis not silently ignored at the type level — the variant still exists — butPhysicsWorld::stepfalls back to runningXpbdfor that build, since there is no TGS implementation to dispatch to. This is a documented, defined fallback (a different already-correct solver runs), not state corruption.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Xpbd
Extended Position-Based Dynamics — the solver this crate has shipped since 0.1.0. Default.
Tgs
Sub-stepping impulse-based temporal Gauss-Seidel. See the gaps listed
on SolverBackend itself before using this in production.
Trait Implementations§
Source§impl Clone for SolverBackend
impl Clone for SolverBackend
impl Copy for SolverBackend
Source§impl Debug for SolverBackend
impl Debug for SolverBackend
Source§impl Default for SolverBackend
impl Default for SolverBackend
impl Eq for SolverBackend
Source§impl PartialEq for SolverBackend
impl PartialEq for SolverBackend
impl StructuralPartialEq for SolverBackend
Auto Trait Implementations§
impl Freeze for SolverBackend
impl RefUnwindSafe for SolverBackend
impl Send for SolverBackend
impl Sync for SolverBackend
impl Unpin for SolverBackend
impl UnsafeUnpin for SolverBackend
impl UnwindSafe for SolverBackend
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
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> ⓘ
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 more