Shapes created with PhysicsEditor are not parsed properly by Phaser. It has something
https://codepen.io/nvitaterna/pen/RwNqqKN
PhysicsEditor exports the verticies in a 2D array. When this is flattened then re-wrapped (to satisfy Phaser's vertex sorting function) another array it gets the proper shape:
playerShipJson.playerShip3_blue.fixtures[0].vertices = [playerShipJson.playerShip3_blue.fixtures[0].vertices.reduce((a, b) => a.concat(b), [])];
I am new to using Matter.js but I believe I am following the docs properly in the way I have this set up.
Which version of Physics Editor are you using? I just tried an export with the version I have installed (which is 1.8.4 on macOS). I traced a shape, picked Phaser 3 as the export, saved the json and it worked fine. vertices should be an array of sub-arrays, as that is what the parser expects.
Maybe upload your pes file here so I can open it and see how it exports for me.
I am using 1.8.4 on windows. Here is my .pes file. Just to be clear, I am selecting "Phaser (matter.js)" as the exporter.
https://github.com/nvitaterna/phaser-physicseditor-issue/raw/master/test.pes
I'm having some weirdness too:
In PhysicsEditor:

Gets rendered as:

This is the data PhysicsEditor dumps out:
"character": {
"type": "fromPhysicsEditor",
"label": "character",
"isStatic": false,
"density": 0.1,
"restitution": 0.2,
"friction": 0.7,
"frictionAir": 0.01,
"frictionStatic": 10,
"collisionFilter": {
"group": 0,
"category": 1,
"mask": 255
},
"fixtures": [
{
"label": "",
"isSensor": false,
"vertices": [
[ { "x":94, "y":195 }, { "x":84, "y":151 }, { "x":54, "y":89 }, { "x":31, "y":112 }, { "x":31, "y":195 } ],
[ { "x":7, "y":13 }, { "x":1, "y":43 }, { "x":8, "y":66 }, { "x":54, "y":89 }, { "x":83, "y":92 }, { "x":69, "y":20 }, { "x":33, "y":0 } ],
[ { "x":99, "y":3 }, { "x":69, "y":20 }, { "x":83, "y":92 }, { "x":118, "y":47 }, { "x":118, "y":16 } ],
[ { "x":101, "y":149 }, { "x":83, "y":92 }, { "x":54, "y":89 }, { "x":84, "y":151 } ]
]
}
]
}
This might just be a bug in the debug rendering though as it seems behave as normal
@Jazcash thats perfectly normal. PE doesn鈥檛 show the decomposed polygon. The debug render is the actual result once the vertices have been decomposed into proper convex bodies.
Closing because this seems to be a query that now has an answer. Cheers!
Whoops. The original reported issue _could_ be a bug with debug rendering, where the an edge isn't rendered between the last vertex and the first. This is evident in both the code example shared and the screenshot posted later. Reopening. :nerd_face:
i am seeing this as well.
Most helpful comment
@Jazcash thats perfectly normal. PE doesn鈥檛 show the decomposed polygon. The debug render is the actual result once the vertices have been decomposed into proper convex bodies.