Page 1 of 1

solid array

Posted: August 25th, 2004, 2:29 pm
by MEGABASTARD
Hey guys,

im trying to write an expression to create a cubic 3d array made from solids.

I have got this far:

Code: Select all

numx = 10;
numy = 10;
numz = 10;
space = 75


posx = Math.floor((index - 1)/numx);
posy= (index - 1)%numy;
posz = Math.floor((index - 1)/numz);


x = posx*space + space/2;
y = posy*space + space/2;
z = posz*space + space/2;


[x,y,z] 
I apply it to each layer, i suspect I need to do something with the index number but im not quite sure what it is.

Posted: August 25th, 2004, 11:18 pm
by Disciple
With master Dan Ebbert's compliments.....


numx = 10;
numy = 10;
numz = 10;
space = 75;

center = [thisComp.width/2,thisComp.height/2,0];
xIdx = (index - 1)%numx;
yIdx = Math.floor((index - 1)/numx)%numy;
zIdx = Math.floor((index - 1)/(numx*numy));

x = space*(xIdx - (numx - 1)/2);
y = space*(yIdx - (numy - 1)/2);
z = space*(zIdx - (numz - 1)/2);

center + [x,y,z]

Posted: August 26th, 2004, 4:52 am
by MEGABASTARD
That guy........

How much beer is he owed now?

thanks.