1681-engine / index / PhysicsWorldOptions
Interface: PhysicsWorldOptions ​
Defined in: src/physics/PhysicsWorldOptions.ts:4
Tuning for a PhysicsWorld; every field has a default fit for a platformer in pixels.
Extends ​
Partial<SolverSettings>
Properties ​
allowSleep? ​
optional allowSleep?: boolean;Defined in: src/physics/PhysicsWorldOptions.ts:21
Let bodies at rest stop being simulated until something touches them (default false).
cellSize? ​
optional cellSize?: number;Defined in: src/physics/PhysicsWorldOptions.ts:9
Broad-phase cell size, px (default 64): about the size of a typical body or a few tiles.
contactMargin? ​
optional contactMargin?: number;Defined in: src/physics/PhysicsWorldOptions.ts:17
Gap (px) at which a pair already counts as touching (default 0.5).
correction? ​
optional correction?: number;Defined in: src/physics/ContactSolver.ts:11
Share of the remaining overlap removed per position iteration.
Inherited from ​
gravityX? ​
optional gravityX?: number;Defined in: src/physics/PhysicsWorldOptions.ts:6
Px/s² (default 0, 980: y grows downwards, so positive y falls).
gravityY? ​
optional gravityY?: number;Defined in: src/physics/PhysicsWorldOptions.ts:7
groundNormal? ​
optional groundNormal?: number;Defined in: src/physics/PhysicsWorldOptions.ts:19
A contact normal with an upward share above this grounds a body (default 0.7, ground up to ~45°).
maxCorrection? ​
optional maxCorrection?: number;Defined in: src/physics/ContactSolver.ts:13
The most one position iteration moves a pair apart (px), so a deep overlap is undone over a few steps, not flung.
Inherited from ​
maxSpeed? ​
optional maxSpeed?: number;Defined in: src/physics/PhysicsWorldOptions.ts:15
No body moves faster than this, px/s (default 4000): the bound that makes the sub-steps above enough.
maxSubsteps? ​
optional maxSubsteps?: number;Defined in: src/physics/PhysicsWorldOptions.ts:13
A step is split so no body moves more than its own smallest half size per sub-step, up to this many (default 16).
positionIterations? ​
optional positionIterations?: number;Defined in: src/physics/PhysicsWorldOptions.ts:11
restitutionThreshold? ​
optional restitutionThreshold?: number;Defined in: src/physics/ContactSolver.ts:7
Approach speed (px/s) below which nothing bounces, so a resting body does not hop on gravity's own step.
Inherited from ​
SolverSettings.restitutionThreshold
sleepSpeed? ​
optional sleepSpeed?: number;Defined in: src/physics/PhysicsWorldOptions.ts:22
sleepTime? ​
optional sleepTime?: number;Defined in: src/physics/PhysicsWorldOptions.ts:23
slop? ​
optional slop?: number;Defined in: src/physics/ContactSolver.ts:9
Overlap (px) left alone by position correction: a little keeps resting contacts alive and steady.
Inherited from ​
velocityIterations? ​
optional velocityIterations?: number;Defined in: src/physics/PhysicsWorldOptions.ts:10