photonstorm/phaser — pull request #449 by georgiee (2014-02-19 16:13:07+00:00)
Title: Physics Polygon Loading (convex sub polygons vs hull polygons)

Hi Rich,
1. is to merge, 2. is for discussion

1. But first of all. There is a missing this in #loadPolygon see this commit https://github.com/georgiee/phaser/commit/b67dc625aa59e0e1c41a5f7126d5aa69e4f3fc4b

2. See my example file in commit https://github.com/georgiee/phaser/commit/11c61eee35f90b2d27ef7b1e64b4d25bbf6893ea
It's exported from PhysicsEditor with polygons of two flipper arms. PhysicsEditor does a decomposing so that a large polygon hull is broken down in many smaller convex sub polygons. I know this from Box2D. There is a limit for polygons therefore you really have to do it. It seems that p2.js is doing this already internally and doesn't expect any prepared sub polygons.
Therefore my attempt in this commit https://github.com/georgiee/phaser/commit/791ac4b751c87752ef69dc355638d8d6134b7cc3 to simply build ALL provided polygons fails.

Now I have a file format problem. My export from PhysicsEditor (with exporter 'Lime + Corona (JSON)' ) fails. I have to do it with the exporter 'Plain Text (demo exporter)' and take the list of hull polygons from there (https://github.com/georgiee/phaser/commit/2a3cd3303303cf27ccb9034c5239fbcbd0c06791) and prepare the JSON file myself.

The question: Is the export of PhysicsEditor with all the sub polygons wrong or the import in phaser (which states that it's supporting Lime + Corona (JSON) ?