MEL script rigid bodys?

MEL script rigid bodys?

Anonymous
Not applicable
325 Views
4 Replies
Message 1 of 5

MEL script rigid bodys?

Anonymous
Not applicable
Hi all. I am new in scripting, but I wanted to move center of Mass on all my rigid body objects with MEL script, but it fails to execute. Please help me to find the mistake.



for ($i = 1; $i <= 100; $i++)
{
setAttr "rigidBody$i.centerOfMassY" -7.131;
setAttr "rigidBody$i.centerOfMassZ" -6.28;
};

// Error: line 3: setAttr: No object matches name: rigidBody$i.centerOfMassY //



How can I make MEL understand that $i is a number?
0 Likes
326 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
setAttr ("rigidBody" + $i + ".centerOfMassY") -7.131;
0 Likes
Message 3 of 5

Anonymous
Not applicable
setAttr ("rigidBody" + $i " ".centerOfMassY") -7.131;


Thanks THNKR, but now there are new errors...


for ($i = 74; $i <= 141; $i++) //line 1
{
setAttr ("rigidBody" + $i " ".centerOfMassY") -7.131;
setAttr ("rigidBody" + $i " ".centerOfMassZ") -6.28;
};
//line 6

// Error: setAttr ("rigidBody" + $i " ".centerOfMassY") -7.131;
//
// Error: Line 3.29: Syntax error //
// Error: //
// Error: Line 6.0: Syntax error //

0 Likes
Message 4 of 5

Anonymous
Not applicable
Fixed a typo
0 Likes
Message 5 of 5

Anonymous
Not applicable
Thank you, THNKR! it worked!
0 Likes