API Docs for: 0.4.0
Show:

GSSolver Class

Extends Solver

Iterative Gauss-Seidel constraint equation solver.

Constructor

GSSolver

(
  • [options]
)

Parameters:

  • [options] Object optional
    • iterations Number
    • timeStep Number
    • stiffness Number
    • relaxation Number
    • tolerance Number

Methods

addEquation

(
  • eq
)

Add an equation to be solved.

Parameters:

addEquations

(
  • eqs
)

Add equations. Same as .addEquation, but this time the argument is an array of Equations

Parameters:

  • eqs Array

removeAllEquations

()

Remove all currently added equations.

removeEquation

(
  • eq
)

Remove an equation.

Parameters:

solve

(
  • dt
  • world
)

Inherited from Solver but overwritten in src/solver/GSSolver.js:82

Solve the system of equations

Parameters:

  • dt Number

    Time step

  • world World

    World to solve

sortEquations

()

Sort all equations using the .equationSortFunction. Should be called by subclasses before solving.

Properties

equations

Array

Current equations in the solver.

equationSortFunction

Function | Boolean

Function that is used to sort all equations before each solve.

iterations

Number

The number of iterations to do when solving. More gives better results, but is more expensive.

relaxation

Number

Global equation relaxation. This is the number of timesteps required for a constraint to be resolved. Larger number will give softer contacts. Set to around 3 or 4 for good enough results.

skipFrictionIterations

Number

Number of friction iterations to skip. If .skipFrictionIterations=2, then no FrictionEquations will be iterated until the third iteration.

stiffness

Number

Global equation stiffness. Larger number gives harder contacts, etc, but may also be more expensive to compute, or it will make your simulation explode.

tolerance

Number

The error tolerance. If the total error is below this limit, the solver will stop. Set to zero for as good solution as possible.

useGlobalEquationParameters

Boolean

Whether to use .stiffness and .relaxation parameters from the Solver instead of each Equation individually.

useZeroRHS

Boolean

Set to true to set all right hand side terms to zero when solving. Can be handy for a few applications.