Vertex order in JSON

Report problems here (or use the built-in feedback dialog in the editor)
Post Reply
Posts: 2
Joined: Wed Sep 02, 2015 7:57 pm

Vertex order in JSON

Post by Achder »

for my project it is important, that the vertex-order stays the way it is signaled in the editor. But when I export to a json file, the vertex order gets mixed up (it's still ccw, but the "first" vertex is not the first). For clarification: The expected vertex index is the one, that the editor shows me, when I hover over a vertex in vertex mode. Could you please fix this?
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Vertex order in JSON

Post by iforce2d »

I'll presume you are talking about convex polygons with only 8 sides or less, because a polygon that is either concave or has more than eight vertices would required decomposition into multiple sub-polygons and the vertex order would be different anyway.

All I can suggest is to make a copy of the polygon and set it to be a 'loop' shape so that it does not undergo polygon decomposition during export, and the vertex ordering would be unaffected. After loading the scene into your game you can get the vertices in their original order from this loop shape, and then destroy it.
Post Reply