I started using Phaser recently, and I came across a problem that kind of annoyed me since I didn't find any really satisfying answers yet (on this forum or anywhere on the internet)
I'm trying to create non-convex polygon-shaped sprites, I know I have to use P2 physics to accomplish that, and precisely the loadPolygon function. The thing is, everyone seems to be working with PhysicsEditor to generate JSON files to feed this function, and I'm looking for a free alternative.
I eventually found 2 alternatives, but :
- https://loonride.com/tools/physics : doesn't seems to work (clicking on "downloads" or "URLs & code" does absolutely nothing)
- http://subefotos.esy.es/PhysicsEditor/ : for some reason, everytime I click "New image", my PC freezes to death... (I tried on a different PC and it works, but even then you have to create manually all the "polygon groups", and I'm looking for something that would generate these for me)
I put together a little editor that lets you define points on a sprite and triangulate the polygon to create the desired JSON file (that contains the list of these triangles), but I'm wondering if there is a simpler way to answer this problematic ? I also tried to use addPolygon, but there was this weird offset because Phaser wants to adjust the center of mass, I didn't find how to avoid that (just commenting the call to the function which adjust the center of mass, as I've read on this forum, didn't do the trick, the offset was different but still there)