This probably has been done before, but I’m making a ‘generate-randomised-polygon’ addon – so why not share its development here, right? :eyebrowlift:
The idea is to generate a (2D/XY) polygon/face, by ‘randomly walking’ along the vertices/edges of it. So we’d walk for a (randomly generated) length/distance along a (randomly generated/updated) direction from the current vertex to the next. You can specify the number of vertices, a range for the lengths of the edges, and a range for the angles to turn at every vertex. If requested, I’ll happily go into some more detail about how this works and/or why this might be useful.
. Added a random range for the number of vertices
. Added a random rotation to the extruded (or only) face
. Added an option to put the objects on the XY-plane (ie, move them up a bit)
. Cleaned up the interface (I hope)
Added (optional) control over the dimensions of the resulting meshes. This could be useful when generating some oblong/elongated variations of the bricks. You may want to increase your number of vertices (*) to obtain the desired result.
Added an option to try (!) and keep the generated polygon convex. ATM, this only looks at the first and last vertices, as that’s where the concavity/non-convexity tends to turn up. I’m not sure this totally guarantees convexity, but it does rule out some obvious cases.
Convexity, btw, is a very important thing to have, especially if you want to physically simulate your results, as mentioned above. If you have convex geometry, you can use the ‘convex hull’ as a collision shape, rather than ‘mesh’ – the latter of which more accurately simulates your (possibly non-convex) objects, but is (much) more costly (will take (a lot) longer). Please let me know if you come across any settings that produce non-convex meshes – with ‘Keep Convex’ turned on, and without negative vertex turning angles, of course…
The ‘Origin -Z’ option sets the z coordinate of the origin of the generated object to the z coordinate of the cursor. This may also be useful for positioning your objects in the scene for further use/simulation. The previous version already might have had this (unexplained) option.
Just for completeness, I added a Z/X redimensioning option. It allows the same ‘X-dimension-drivenness’ on the Z-dimension as the aforementioned Y/X option does for the Y-dimension.