shaunumb Posted March 13, 2014 Share Posted March 13, 2014 Hey I'm trying to find a tool that will let me export the correct style JSON to add to a sprite using the .setPolygon() method. I've tried all the export settings from PhysicsEditor and none seem to provide the correct JSON. Is this the best tool to be used to create points from a shape with a transparent background? The polygon itself is quite complex, consisting of around 400 points. I wonder if it's even possible with this many points? Link to comment Share on other sites More sharing options...
prtksxna Posted March 13, 2014 Share Posted March 13, 2014 I am not sure what the problem might be. Just guessing, is your polygon convex or concave? Some physics engines will not take concave polygons and you'll have to build those by joining convex polygons together. Could that be the issue? Link to comment Share on other sites More sharing options...
shaunumb Posted March 13, 2014 Author Share Posted March 13, 2014 Erm... actually it's a really long wiggly line so I guess it's both concave and convex. I can see it's plotted the points correctly in PhysicsEditor, but I don't really know what to do with the exported format. I need a simple 1D JSON array of x,y coords e.g. [0,50, 300,20... etc] , but what I get out of PhysicsEditor using the Lime + Corona setting (for example) is something like: {"density": 0, "friction": 0, "bounce": 0, "filter": { "categoryBits": 0, "maskBits": 0 },"shape": [ 129, 5000 , 129, 4980 , 136, 4982 , 134, 5000 ]} ,{"density": 0, "friction": 0, "bounce": 0, "filter": { "categoryBits": 0, "maskBits": 0 },"shape": [ 34, 3852 , 31, 3874 , 27, 3896 , 25, 3870 ]} ,{"density": 0, "friction": 0, "bounce": 0, "filter": { "categoryBits": 0, "maskBits": 0 },"shape": [ 136, 4551 , 147, 4566 , 158, 4586 , 143, 4571 ]} , Link to comment Share on other sites More sharing options...
shaunumb Posted March 14, 2014 Author Share Posted March 14, 2014 Right, there is a way of getting the correct the coords from SpriteHelper App... however it seems that Phaser doesn't calculate the overlap correctly on concave polygons I've attached a screenshot of the two elements not overlapping with debug on, but Phaser still sees it as an overlap. Link to comment Share on other sites More sharing options...
Recommended Posts