This might be a very useful feature for some cases, which I believe it's quite easy to implement.
Basically, there would be a new menu entry under "Vertex", something like "Set as start vertex" or "Set as index 0", that would make that vertex the first (index 0) in a polygon/line/loop fixture.
By the way, R.U.B.E. is awsome, but some of the request features would be really, really helpful.
Mostly "Instantiable objects" and/or "Display layers" IMO.
Thanks.
Set a polygon's vertex as index 0 (zero)
Re: Set a polygon's vertex as index 0 (zero)
Here is a script to do that:
Make sure you have just the one vertex selected when you run it.
Keep in mind that for polygons, the order of vertices in the exported file will not be preserved, because polygons go through a convex decomposition process, and are made into multiple sub-polygons. For lines and loops though, you can expect the vertex ordering to be the same as what you see in the editor.
Code: Select all
vertex v = sv()[0];
fixture f = v.getFixture();
vertex[] vs = f.getVertices();
int index = v.index;
for (int i = 0; i < index; i++)
f.addVertex( -1, vs[i].pos );
for (int i = 0; i < index; i++)
f.deleteVertex(0);
Keep in mind that for polygons, the order of vertices in the exported file will not be preserved, because polygons go through a convex decomposition process, and are made into multiple sub-polygons. For lines and loops though, you can expect the vertex ordering to be the same as what you see in the editor.
-
- Posts: 2
- Joined: Wed Oct 22, 2014 12:18 pm
Re: Set a polygon's vertex as index 0 (zero)
That's great, thanks a lot.
To be honest, I didn't look into scripts yet, but I guess I have to.
To be honest, I didn't look into scripts yet, but I guess I have to.