Physics · interface
WorldOptions
Options a consumer sets once. Every one of them is a quality or feel dial, not a contract.
Explained in Your first game, Rigid bodies.
interface WorldOptionsimport type { WorldOptions } from '@driftengine/physics';Properties
| Name | Type | Description |
|---|---|---|
substepsoptional | number | How many integrate-and-solve passes per tick. A quality dial: raising it changes nothing. |
iterationsoptional | number | Iterations per substep. |
gravityXoptional | number | |
gravityYoptional | number | |
gravityZoptional | number | |
contactHertzoptional | number | Contact stiffness as a frequency, which is what makes substeps a dial. |
contactDampingoptional | number | |
jointHertzoptional | number | Joint stiffness, higher than a contact's because a joint is a structural relationship. |
jointDampingoptional | number | |
linearDampingoptional | number | |
angularDampingoptional | number | |
speculativeMarginoptional | number | How far apart two shapes may be and still get a constraint. |
allowSleepoptional | boolean | Whether settled islands stop being solved. On by default; off for a test isolating something. |
frictionModeloptional | FrictionModel | How the two friction axes are bounded against each other. box by default. See solver.ts.More
|
workersoptional | number | How many workers solve islands. 0, the default, is the serial runner and changes nothing.MoreIt needs a cross-origin isolated page. Without one |
spawnoptional | () => PoolWorker | Build one worker yourself.MoreThe default is |
pooloptional | (request: PoolRequest) => PoolOutcome | What builds the pool. createIslandPool is the one this package ships.MorePassed in rather than imported here, and the reason is a measurement made twice. A
That was half the problem and the other half cost 4.7 times as much. Naming the factory at
the call site let tree-shaking drop the pool, and a bundler had already emitted the worker —
Asking for workers without it is not silent: |