PDA

View Full Version : A grid of cubes


H3ro
03-25-2006, 05:11 PM
I want to create a grid of cubes, but cant find a good way to do it.
If anyone could help, it would be very kindly

This is what i have so far:

{
//Create a grid of cubes
int $cubeW =10 ; //no of cubes in X
int $cubeB =10 ; //no of cubes in Z


//Creating the Cubes


int $noCubeW = 0;
int $noCubeB = 0;

while ($noCubeW <= $cubeW)
{

while ($noCubeB <= $cubeB)
{polyCube -w 1
-h 1
-d 1
-sx 1
-sy 1
-sz 1
-ax 0 1 0
-tx 1
-ch 1;

move -r $noCubeB 0 $noCubeW;
$noCubeB++;
}


$noCubeW++;
}

But, it dont work....

Thanks for you time:)

McWolfe
03-25-2006, 08:06 PM
Just from the top of my head.. but wouldn't it work using the Duplicate command. Just create one cube, and then use duplicate with the right settings to create the grid.

McWolfe

I want to create a grid of cubes, but cant find a good way to do it.
If anyone could help, it would be very kindly

This is what i have so far:

{
//Create a grid of cubes
int $cubeW =10 ; //no of cubes in X
int $cubeB =10 ; //no of cubes in Z


//Creating the Cubes


int $noCubeW = 0;
int $noCubeB = 0;

while ($noCubeW <= $cubeW)
{

while ($noCubeB <= $cubeB)
{polyCube -w 1
-h 1
-d 1
-sx 1
-sy 1
-sz 1
-ax 0 1 0
-tx 1
-ch 1;

move -r $noCubeB 0 $noCubeW;
$noCubeB++;
}


$noCubeW++;
}

But, it dont work....

Thanks for you time:)

H3ro
03-25-2006, 11:45 PM
I was also thinking of that, but I am not sure how to turn all the boxes into a string/selection

Thanks

tciny
03-25-2006, 11:56 PM
all idividual shapes:
$sizeX = 10;
$sizeZ = 10;

for( $x=0; $x<$sizeX; $x++ )
for( $z=0; $z<$sizeZ; $z++ )
{
polyCube;
move -a ($x-($sizeX/2.0)) 0 ($z-($sizeZ/2.0));
}

Instances:
$sizeX = 10;
$sizeZ = 10;

polyCube;
for( $x=0; $x<$sizeX; $x++ )
for( $z=0; $z<$sizeZ; $z++ )
{
instance;
move -a ($x-($sizeX/2.0)) 0 ($z-($sizeZ/2.0));
}

CGTalk Moderation
03-25-2006, 11:56 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.