bendingiscool
02-24-2009, 11:45 PM
Hey, I'm working on some crowd stuff at the moment, unfortunatly I have run into an error and have been looking at this code for far too long as my head appears to have gone to mush...
rigidSolver -create -current -solverMethod 0 -collisionTolerance .1 -name crowdSimSolver;
setAttr crowdSimSolver.allowDisconnection 1;
setAttr crowdSimSolver.displayVelocity 1;
spaceLocator;
$agentAmount = 10;
// Make Agents
for ($i = 0; $i < $agentAmount; $i++) {
string $plusMinusNode = `createNode plusMinusAverage -n ("PMAnode_" + $i)`;
polyCylinder -name ("agentBase_" + $i) -radius 0.2 -subdivisionsX 14 -height .01;// Make cylinder
radial -position 0 0 0 -name ("agentRadial_" + $i) -magnitude 20 -attenuation 0.3 -maxDistance 4.0;
parent ("agentRadial_" + $i) ("agentBase_" + $i);
hide ("agentRadial_" + $i);
rigidBody -name ("RBagent_" + $i) -active -mass 1 -bounciness 0
-damping 10 -position 10 0 10 -impulse 0 0 0 -standInObject cube -solver crowdSimSolver ("agentBase_" + $i);
connectAttr -f ("agentBase_" + $i + ".translate")("PMAnode_" + $i + ".input3D[0]");
connectAttr -f locator1.translate ("PMAnode_" + $i + ".input3D[1]");
string $exp = "float $cylPos" + $i + "[];\n";
$exp += "$cylPos" + $i + " = `getAttr PMAnode_" + $i + ".input3D[0]`;\n";
$exp += "float $locPos" + "[];\n";
$exp += "$locPos" + " = `getAttr PMAnode_" + $i + ".input3D[1]`;\n";
$exp += "setAttr ";
$exp += "(RBagent_" + $i + ".impulse)";
$exp += "($locPos[0] - $cylPos" + $i + "[0])";
$exp += "($locPos[1] - $cylPos" + $i + "[1])";
$exp += "($locPos[2] - $cylPos" + $i + "[2])";
expression -s $exp -name ("walk_exp" + $i) -alwaysEvaluate true -unitConversion all;
}
cycleCheck -e off
I'm getting this error...
// Error: Attributes must be of float, integer, or boolean types: impulse //
But am unsure why/how it's erroring as it looks ok to me, anyhelp would be much appreciated.
Chris
rigidSolver -create -current -solverMethod 0 -collisionTolerance .1 -name crowdSimSolver;
setAttr crowdSimSolver.allowDisconnection 1;
setAttr crowdSimSolver.displayVelocity 1;
spaceLocator;
$agentAmount = 10;
// Make Agents
for ($i = 0; $i < $agentAmount; $i++) {
string $plusMinusNode = `createNode plusMinusAverage -n ("PMAnode_" + $i)`;
polyCylinder -name ("agentBase_" + $i) -radius 0.2 -subdivisionsX 14 -height .01;// Make cylinder
radial -position 0 0 0 -name ("agentRadial_" + $i) -magnitude 20 -attenuation 0.3 -maxDistance 4.0;
parent ("agentRadial_" + $i) ("agentBase_" + $i);
hide ("agentRadial_" + $i);
rigidBody -name ("RBagent_" + $i) -active -mass 1 -bounciness 0
-damping 10 -position 10 0 10 -impulse 0 0 0 -standInObject cube -solver crowdSimSolver ("agentBase_" + $i);
connectAttr -f ("agentBase_" + $i + ".translate")("PMAnode_" + $i + ".input3D[0]");
connectAttr -f locator1.translate ("PMAnode_" + $i + ".input3D[1]");
string $exp = "float $cylPos" + $i + "[];\n";
$exp += "$cylPos" + $i + " = `getAttr PMAnode_" + $i + ".input3D[0]`;\n";
$exp += "float $locPos" + "[];\n";
$exp += "$locPos" + " = `getAttr PMAnode_" + $i + ".input3D[1]`;\n";
$exp += "setAttr ";
$exp += "(RBagent_" + $i + ".impulse)";
$exp += "($locPos[0] - $cylPos" + $i + "[0])";
$exp += "($locPos[1] - $cylPos" + $i + "[1])";
$exp += "($locPos[2] - $cylPos" + $i + "[2])";
expression -s $exp -name ("walk_exp" + $i) -alwaysEvaluate true -unitConversion all;
}
cycleCheck -e off
I'm getting this error...
// Error: Attributes must be of float, integer, or boolean types: impulse //
But am unsure why/how it's erroring as it looks ok to me, anyhelp would be much appreciated.
Chris
