solid array

Moderators: Disciple, zlovatt

Post Reply
MEGABASTARD
Posts: 3
Joined: June 23rd, 2004, 2:03 am
Location: London

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.
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

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]
MEGABASTARD
Posts: 3
Joined: June 23rd, 2004, 2:03 am
Location: London

That guy........

How much beer is he owed now?

thanks.
Post Reply