Skip to content

Commit 2008438

Browse files
committed
Added new Matter World config def
1 parent 0a0330b commit 2008438

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

src/physics/matter-js/World.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var Vector = require('./lib/geometry/Vector');
3131
* @since 3.0.0
3232
*
3333
* @param {Phaser.Scene} scene - The Scene to which this Matter World instance belongs.
34-
* @param {object} config - [description]
34+
* @param {Phaser.Types.Physics.Matter.MatterWorldConfig} config - The Matter World configuration object.
3535
*/
3636
var World = new Class({
3737

@@ -207,8 +207,8 @@ var World = new Class({
207207
debugShowStaticBody: GetFastValue(config, 'debugShowStaticBody', true),
208208
debugShowVelocity: GetFastValue(config, 'debugShowVelocity', true),
209209
bodyDebugColor: GetFastValue(config, 'debugBodyColor', 0xff00ff),
210-
bodyDebugFillColor: GetFastValue(config, 'bodyDebugFillColor', 0xe3a7e3),
211-
staticBodyDebugColor: GetFastValue(config, 'debugBodyColor', 0x0000ff),
210+
bodyDebugFillColor: GetFastValue(config, 'debugBodyFillColor', 0xe3a7e3),
211+
staticBodyDebugColor: GetFastValue(config, 'debugStaticBodyColor', 0x0000ff),
212212
velocityDebugColor: GetFastValue(config, 'debugVelocityColor', 0x00ff00),
213213
debugShowJoint: GetFastValue(config, 'debugShowJoint', true),
214214
jointDebugColor: GetFastValue(config, 'debugJointColor', 0x000000),
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* @typedef {object} Phaser.Types.Physics.Matter.MatterWorldConfig
3+
* @since 3.0.0
4+
*
5+
* @property {Phaser.Types.Math.Vector2Like} [gravity] - Sets {@link Phaser.Physics.Matter.World#gravity}.
6+
* @property {(object|boolean)} [setBounds] - Should the world have bounds enabled by default?
7+
* @property {number} [setBounds.x=0] - The x coordinate of the world bounds.
8+
* @property {number} [setBounds.y=0] - The y coordinate of the world bounds.
9+
* @property {number} [setBounds.width] - The width of the world bounds.
10+
* @property {number} [setBounds.height] - The height of the world bounds.
11+
* @property {number} [setBounds.thickness=64] - The thickness of the walls of the world bounds.
12+
* @property {boolean} [setBounds.left=true] - Should the left-side world bounds wall be created?
13+
* @property {boolean} [setBounds.right=true] - Should the right-side world bounds wall be created?
14+
* @property {boolean} [setBounds.top=true] - Should the top world bounds wall be created?
15+
* @property {boolean} [setBounds.bottom=true] - Should the bottom world bounds wall be created?
16+
* @property {number} [positionIterations=6] - The number of position iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance.
17+
* @property {number} [velocityIterations=4] - The number of velocity iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance.
18+
* @property {number} [constraintIterations=2] - The number of constraint iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance.
19+
* @property {boolean} [enableSleeping=false] - A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module. Sleeping can improve stability and performance, but often at the expense of accuracy.
20+
* @property {number} [timing.timestamp=0] - A `Number` that specifies the current simulation-time in milliseconds starting from `0`. It is incremented on every `Engine.update` by the given `delta` argument.
21+
* @property {number} [timing.timeScale=1] - A `Number` that specifies the global scaling factor of time for all bodies. A value of `0` freezes the simulation. A value of `0.1` gives a slow-motion effect. A value of `1.2` gives a speed-up effect.
22+
* @property {boolean} [enabled=true] - Toggles if the world is enabled or not.
23+
* @property {number} [correction=1] - An optional Number that specifies the time correction factor to apply to the update.
24+
* @property {function} [getDelta] - This function is called every time the core game loop steps, which is bound to the Request Animation Frame frequency unless otherwise modified.
25+
* @property {boolean} [autoUpdate=true] - Automatically call Engine.update every time the game steps.
26+
* @property {boolean} [debug=false] - Sets if Matter will render to the debug Graphic overlay. Do not enable this in production.
27+
* @property {boolean} [debugShowBody=true] - Should dynamic bodies be drawn to the debug graphic?
28+
* @property {boolean} [debugShowStaticBody=true] - Should static bodies be drawn to the debug graphic?
29+
* @property {boolean} [debugShowVelocity=true] - Should the velocity vector be drawn to the debug graphic?
30+
* @property {number} [debugBodyColor=0xff00ff] - The color that dynamic body debug outlines are drawn in.
31+
* @property {number} [debugBodyFillColor=0xe3a7e3] - The color that dynamic body debug fills are drawn in.
32+
* @property {number} [debugStaticBodyColor=0x0000ff] - The color that static body debug outlines are drawn in.
33+
* @property {number} [debugVelocityColor=0x00ff00] - The color that the debug velocity vector lines are drawn in.
34+
* @property {boolean} [debugShowJoint=true] - Render joints to the debug graphic.
35+
* @property {number} [debugJointColor=0x000000] - The color that the debug joints are drawn in.
36+
* @property {boolean} [debugWireframes=true] - Render the debug output as wireframes.
37+
* @property {boolean} [debugShowInternalEdges=false] - Render internal edges to the debug.
38+
* @property {boolean} [debugShowConvexHulls=false] - Render convex hulls to the debug.
39+
* @property {number} [debugConvexHullColor=0xaaaaaa] - The color that the debug convex hulls are drawn in, if enabled.
40+
* @property {boolean} [debugShowSleeping=false] - Render sleeping bodies the debug.
41+
*/

0 commit comments

Comments
 (0)