1
ASL Scripts / difficulty creating mesh with script
« on: February 26, 2008, 09:55:53 pm »
Hello all- I'm trying to use anim8or to visualize data coming out of another program. Basically, I have a working trial script, but when I have my program write a script, it displays nothing (though the console claims no errors and successful exit). Below are excerpts of both -- any ideas why the 1st works and the 2nd doesn't? Thanks.
This one works:
But this one doesn't:
This one works:
Code: [Select]
$mymesh.Open();
for $i = 0 to 99 step 1 do {
$index[$i] = $mymesh.AddPoint(($i%10, $i/10, 1));
}
/* assigning meshpoints to faces (or is it faces to meshpoints?) */
for $y = 0 to 8 step 1 do {
for $x = 0 to 8 step 1 do {
$mymesh.OpenFace(0,0);
$mymesh.VertexN($index[10*($y) + ($x)]);
$mymesh.VertexN($index[10*($y) + ($x + 1)]);
$mymesh.VertexN($index[10*($y + 1) + ($x + 1)]);
$mymesh.VertexN($index[10*($y + 1) + ($x)]);
$mymesh.CloseFace();
}
}
$mymesh.RemoveUnusedData();
$mymesh.Close();
But this one doesn't:
Code: [Select]
$heightmesh.Open();
/* creating mesh, point by point */
$index[0] = $heightmesh.AddPoint((0, 0, 1));
$index[1] = $heightmesh.AddPoint((1, 0, 1));
$index[2] = $heightmesh.AddPoint((2, 0, 1));
$index[3] = $heightmesh.AddPoint((3, 0, 1));
$index[4] = $heightmesh.AddPoint((4, 0, 1));
$index[5] = $heightmesh.AddPoint((5, 0, 1));
$index[6] = $heightmesh.AddPoint((6, 0, 1));
$index[7] = $heightmesh.AddPoint((7, 0, 1));
$index[8] = $heightmesh.AddPoint((8, 0, 1));
$index[9] = $heightmesh.AddPoint((9, 0, 1));
$index[10] = $heightmesh.AddPoint((0, 1, 1));
$index[11] = $heightmesh.AddPoint((1, 1, 1));
$index[12] = $heightmesh.AddPoint((2, 1, 1));
...
$index[97] = $heightmesh.AddPoint((7, 9, 1));
$index[98] = $heightmesh.AddPoint((8, 9, 1));
$index[99] = $heightmesh.AddPoint((9, 9, 1));
/* assigning meshpoints to facees (or vice versa?)
$heightmesh.OpenFace(0,0);
$heightmesh.VertexN($index[0]);
$heightmesh.VertexN($index[1]);
$heightmesh.VertexN($index[11]);
$heightmesh.VertexN($index[10]);
$heightmesh.CloseFace();
$heightmesh.OpenFace(0,0);
$heightmesh.VertexN($index[1]);
$heightmesh.VertexN($index[2]);
$heightmesh.VertexN($index[12]);
$heightmesh.VertexN($index[11]);
$heightmesh.CloseFace();
...
$heightmesh.OpenFace(0,0);
$heightmesh.VertexN($index[88]);
$heightmesh.VertexN($index[89]);
$heightmesh.VertexN($index[99]);
$heightmesh.VertexN($index[98]);
$heightmesh.CloseFace();
$heightmesh.RemoveUnusedData();
$heightmesh.Close();