Error: Line 127.20: Matrix element must be a scalar numeric type.
tweaking i get this error in teh same line:
Cannot convert data of type float[] to type float
the errors are in this proc
proc vector getPosition (string $obj)
{
$x = getAttr ($obj+".translateX");
//string $type = getAttr -type ($obj+".translateX");
//int $size = getAttr -size ($obj+".translateX");
//print ($type+"-"+$size);
[b]vector $vvv = <<$x, 0, 0>>;[/b]
return $vvv;
}
i dont understand anything, specially cause when i try the code in the procedure appart, i dont get the error!
thanks!
CODE
///////////////////----------------------------------------------------------------------------------------------------------------------------
//GLOBAL VARS
///////////////////
global string $cellarray[];
clear $cellarray;
///////////////////----------------------------------------------------------------------------------------------------------------------------
//PROGRAM
///////////////////
string $selectedcells[] = selectedNodes;
initialize_array($selectedcells);
initialize_attr();
initialize_position();
int $iterations=0;
while($iterations<2)
{
positioncells();
$iterations++;
print ($iterations);
}
///////////////////----------------------------------------------------------------------------------------------------------------------------
//INIT PROCEDURES
///////////////////
proc initialize_array(string $selectedcells[])
{
global string $cellarray[];
int $i;
for ($i=0; $i<=(size($selectedcells));$i++)
{
$cellarray[$i] = $selectedcells[$i];
}
print ($cellarray);
}
proc initialize_attr() //add atributes
{
global string $cellarray[];
}
proc initialize_position() //store original location
{
global string $cellarray[];
}
///////////////////----------------------------------------------------------------------------------------------------------------------------
//REACTION PROCEDURES
///////////////////
proc positioncells()
{
global string $cellarray[];
vector $vAvoid;
for ($cell in $cellarray)
{
$vAvoid = avoid($cell);
print ($vAvoid);
refreshcells($cell); //, $vAvoid
}
}
///////////////////----------------------------------------------------------------------------------------------------------------------------
//REACTION PROCEDURES
///////////////////
proc vector avoid(string $cell)
{
global string $cellarray[];
vector $v, $cposition, $tposition, $result;
float $dif;
for($target in $cellarray)
{
if ($target != $cell)
{
$cposition = getPosition ($cell); //store them in vector
$tposition = getPosition ($target);
$result = subsVectors($tposition, $cposition);
$dif = mag($result);
if ($dif > 3)
{
$v = <>;
}
}
}
return $v;
print (" r:"+$result+" v:"+$v+"[]");
}
///////////////////-------///////////////////--------///////////////////--------///////////////////-----///////////////////
proc refreshcells(string $cell) //, vector $v1
{
print ("refreshing "+$cell+"||");
//print ($v1);
}
///////////////////----------------------------------------------------------------------------------------------------------------------------
//VECTOR PROCEDURES
///////////////////
proc vector getPosition (string $obj)
{
$x = getAttr ($obj+".translateX");
//string $type = getAttr -type ($obj+".translateX");
//int $size = getAttr -size ($obj+".translateX");
//print ($type+"-"+$size);
vector $vvv = <>;
return $vvv;
}