Linear array + scale array

 From:  Michael Gibson
5595.18 In reply to 5595.12 
Hi DesuDeus, here I've attached a kind of generalized array plug-in called ScriptArray, hopefully it may be of use for this kind of object generation.

This version does not have any UI with it at all, you change parameters in it by editing the command script itself. This goes into the \commands sub-folder just like other commands, it's just that it won't show any UI in the upper-right area when it is running. Also note that MoI caches the contents of command files in memory the first time that it is run, so if you repeatedly edit the file you will need to either shut down and restart MoI on each run after an edit, or save to a new file like ScriptArray2.js, ScriptArray3.js, etc... In the next v3 beta there is a flag that you can set in moi.ini to turn off script caching though which will help with this kind of thing.

With this version you edit the behavior by editing the code at the top of the script file. This version creates copies more like a regular array command, you do not need to create an array with point objects in it like the previous ScaleArray / ShiftArray commands.

You control the number of copies generated by editing the line at the top that says:

code:
var g_NumCopies = 40;


To control the spacing, scaling, and rotation there are 3 functions at the top of the file - UpdateMoveDeltas(), UpdateScaleFactors(), and UpdateRotateAngles() - these are called for each copy of the array and they are passed a point with .x .y .z values that can be modified, reset, randomized, calculated by some math forumla, ... whatever you want.

Currently as a demo it's set up to make 40 copies, and it gradually increases the movement in x for the first 20 copies, then for the second 20 copies gradually reduces it. It increases scaling in x by 0.1 for each step for the first 20, after which it decreases x scaling and starts to increase y scaling, and it rotates around the z axis by an increasing increment of 10 degrees for each step up to 20 then decreasing it. This generates output like so:




So this should help allow for whatever kind of array behavior that you can dream up, you can gradually increase and/or decrease different values, randomize just certain values, etc... hopefully it should serve as a template for generating all kinds of different array effects.

Hope this helps!

- Michael