Phaser API Documentation

fromPhysicsEditor(x, y, config, [options], [addToWorld])


Creates a body using data exported from the application PhysicsEditor (

The PhysicsEditor file should be loaded as JSON:

preload ()
  this.load.json('vehicles', 'assets/vehicles.json);

create ()
  const vehicleShapes = this.cache.json.get('vehicles');
  this.matter.add.fromPhysicsEditor(400, 300, vehicleShapes.truck);

Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it.

If you pas in an options object, any settings in there will override those in the PhysicsEditor config object.


name type arguments Default description
x number

The horizontal world location of the body.

y number

The vertical world location of the body.

config any

The JSON data exported from PhysicsEditor.

options Phaser.Types.Physics.Matter.MatterBodyConfig <optional>

An optional Body configuration object that is used to set initial Body properties on creation.

addToWorld boolean <optional> true

Should the newly created body be immediately added to the World?


A Matter JS Body.

  • MatterJS.BodyType
Since: 3.22.0