place many objects in circle or along the path of a node (copy-and-paste edition)
This Daz Script will place evenly around a circle of radius 18cm oriented to face the Front Camera ... all the nodes in the parent node named Ringo ( used to be Ring but the name was taken )
in fact once Ringo stole the nodes from Ring , please remain seated, Ring was deleted ! Such a waste such a waste.
//Scene.selectAllNodes(true); // legacy from a totally different script
node = Scene.findNodeByLabel( "Ringo" );
nodes = node.getNodeChildren();
r = 18; //all you have to decide and modify is this line
n = ( nodes.length );
twoPi = Math.PI * 2;
arcA = twoPi / 1; // and you could get Arcs instead of full circle by subdividing by 4 for example
stepA = arcA / n;
a = 0;
var toDeg = 180 / Math.PI;
v = new DzVec3( 0, 0, 0 );
for( i = 0; i < n; i++ )
{
node = nodes[i];
v.x = r * Math.cos( a ); // the keen eye will have notice that we could use
v.y = r * Math.sin( a ); // other functions than these and get any 2D path
v.z = -2; // and z doesn't need to be assigned a constant value
node.setWSPos( v );
node.getXRotControl().setValue( 0 );
node.getYRotControl().setValue( 0 );
node.getZRotControl().setValue( a * toDeg + 90 )
a += stepA;
}
Comments
if you animate the position of a node, say the position of the left foot of a figure.
... see below for the working script
script used to place those 160 subd cubes along the path of Gabrielle's right foot
//node containing the things to place along the path
node = Scene.findNodeByLabel( "Ringo" );
nodes = node.getNodeChildren();
n = ( nodes.length );
tick = Scene.getTimeStep() * 1; //making sure it's a number
nFramesPerObject = 3; //spacing the dots along the path
target = Scene.getPrimarySelection(); //selected node is the path
for( i = 0; i < n; i++ )
{
node = nodes[i];
t = i * tick;
v = target.getWSPos( t * nFramesPerObject );
node.setWSPos( v );
}
if we replace
node.setWSPos( v );
with
node.setWSPos( t * nFramesPerObject );
then the subd-cubes will move from their location at frame 0 to their destination keyframe along the path
now what could be their initial position at frame 0 , that's a good question
AH! in gabrielle's shoe !
she could drop footprints !
the foorprints will be dropped say 2 frames after a foot reaches the floor
and the footprints are primitive planes or very low-poly custom-made for the given shoe
mcjRibbons and mcjTransport 2 of my free scripts to make ribbons and tubes that are built along the paths of nodes in a Daz Studio scene