Use PhysicsEditorParser.parseBody() to build a Matter body object, based on a physics data file created and exported with PhysicsEditor (https://www.codeandweb.com/physicseditor).
- Since: 3.10.0
- Source: src/physics/matter-js/PhysicsEditorParser.js (Line 15)
Methods
-
<static> parseBody(x, y, config [, options])
-
Parses a body element exported by PhysicsEditor.
Parameters:
Name Type Argument Description x
number The horizontal world location of the body.
y
number The vertical world location of the body.
config
object The body configuration and fixture (child body) definitions, as exported by PhysicsEditor.
options
Phaser.Types.Physics.Matter.MatterBodyConfig <optional>
An optional Body configuration object that is used to set initial Body properties on creation.
- Since: 3.10.0
- Source: src/physics/matter-js/PhysicsEditorParser.js (Line 24)
Returns:
A compound Matter JS Body.
- Type
- MatterJS.BodyType
-
<static> parseFixture(fixtureConfig)
-
Parses an element of the "fixtures" list exported by PhysicsEditor
Parameters:
Name Type Description fixtureConfig
object The fixture object to parse.
- Since: 3.10.0
- Source: src/physics/matter-js/PhysicsEditorParser.js (Line 70)
Returns:
- An array of Matter JS Bodies.
- Type
- Array.<MatterJS.BodyType>
-
<static> parseVertices(vertexSets [, options])
-
Parses the "vertices" lists exported by PhysicsEditor.
Parameters:
Name Type Argument Description vertexSets
array The vertex lists to parse.
options
Phaser.Types.Physics.Matter.MatterBodyConfig <optional>
An optional Body configuration object that is used to set initial Body properties on creation.
- Since: 3.10.0
- Source: src/physics/matter-js/PhysicsEditorParser.js (Line 104)
Returns:
- An array of Matter JS Bodies.
- Type
- Array.<MatterJS.BodyType>