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 xnumber The horizontal world location of the body.
ynumber The vertical world location of the body.
configobject The body configuration and fixture (child body) definitions, as exported by PhysicsEditor.
optionsPhaser.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 fixtureConfigobject 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 vertexSetsarray The vertex lists to parse.
optionsPhaser.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>
