前回までとは違う方法で岩・石を自動生成するスクリプトを作ってみる。
今回のスクリプトは水晶のような形の岩・石を作るものである。
今回の作り方は以下の通り。
まず、1個岩石を作るスクリプトを作ってみる。
global proc makeRock7()
{
int $i;
float $x, $y, $z;
string $poly[] = `polyCylinder -radius 1.0 -height 2.0 -subdivisionsX 6 -subdivisionsY 1 -subdivisionsZ 1`;
string $ver[] = `polyListComponentConversion -toVertex $poly[0]`;
string $verE[] = `filterExpand -selectionMask 31 $ver`;
for($i = 0; $i < 6; $i++)
{
$x = rand(-0.2, 0.2);
$z = rand(-0.2, 0.2);
select -r $verE[$i];
move -r $x 0 $z;
}
for($i = 6; $i < 12; $i++)
{
$y = rand(-0.3, 0.3);
select -r $verE[$i];
move -r 0 $y 0;
}
$y = rand(0.5, 1.0);
select -r $verE[13];
move -r 0 $y 0;
}
int $i;
float $x, $y, $z;
string $poly[] = `polyCylinder -radius 1.0 -height 2.0 -subdivisionsX 6 -subdivisionsY 1 -subdivisionsZ 1`;
string $ver[] = `polyListComponentConversion -toVertex $poly[0]`;
string $verE[] = `filterExpand -selectionMask 31 $ver`;
for($i = 0; $i < 6; $i++)
$x = rand(-0.2, 0.2);
$z = rand(-0.2, 0.2);
select -r $verE[$i];
move -r $x 0 $z;
for($i = 6; $i < 12; $i++)
$y = rand(-0.3, 0.3);
select -r $verE[$i];
move -r 0 $y 0;
$y = rand(0.5, 1.0);
select -r $verE[13];
move -r 0 $y 0;