my question is as stated in subject. I made some hacky support for layers. I`m not going into details, but it is important that every body has custom property: layer. With value from 0 to 3.
And I need to export every layer to separate json.
So for now I am using script that removes all bodies except specific layer, then I am manually exporting scene to json, then undo script execution (by ctrl+z) so I can have all layers again. And then specify another layer in script and so on...
As you can see it is not effective way, especially when I am testing something on all layers. So is it possible to make this process by script/other way automatic?
Script:
Code: Select all
body[] bodies = ab();
for (uint i = 0; i < bodies.length; i++) {
body b = bodies[i];
if(b.layer!=2) {
b.delete();
}
}