View Full Version : set random mass for rigid bodies
Spynal 03-19-2007, 09:54 PM I am curious if there is a way to attribute a random mass value for some rigid bodies I have to create. I'm not well versed in Mel and I tried to select some geometry, then create it in mel with -m rand(1,5) but that isn't correct. I have 1,000s of pieces of geometry that need to fall randomly. Thank you.
|
|
AndersEgleus
03-21-2007, 12:20 PM
insert into script editor and execute after selecting your objects:
{
string $sel [] = `ls -sl`;
for ($rigid in $sel)
{
float $newMass = rand (1.0, 5.0);
rigidBody -edit -mass $newMass $rigid;
}
}Note that this will not make your objects fall with different acceleration when you apply gravity since gravity is independent of mass. If you apply a uniform field instead of gravity or a drag field in addition to gravity however, the rigid bodies will be differently affected by those fields according to their mass.
CGTalk Moderation
03-21-2007, 12:20 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.