Integrating 3D models with photography
Interested in integrating your 3D work with the real world? This might help
# 1 28-10-2006 , 06:28 AM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095

contraining lots of objects

does anybody know of some code which allows me to orient- and point-constrain 200 objects to 200 other objects in another way than ->


select -r boid_38 ;
select -add mackerel_anim38 ;
pointConstraint -offset 0 0 0 -weight 1;
// Result: mackerel_anim38_pointConstraint1 //
orientConstraint -offset 0 0 0 -weight 1;
// Result: mackerel_anim38_orientConstraint1 //


to do it manually would quite need some time...


everything starts and ends in the right place at the right time.

Last edited by Falott; 28-10-2006 at 06:40 AM.
# 2 28-10-2006 , 07:13 AM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
well if all of your objects are as well named as your example (boid_38 matches mackerel_anim38), the something like this should work

int $counter=1;
int $numObjs=38;

string $boid = "boid_1";
string $mackerel = "mackerel_anim1";

while ($counter <=$numObjs)
{
$boid = ("boid_"+$counter);
$mackerel = ("mackerel_anim"+$counter);
pointConstraint -offset 0 0 0 -weight 1 ($boid ) ($mackerel);

$counter += 1;
}

I have not had time to test the code but it should work. Gotta run. I hope this helped.

-dann

note: just tested it and it works fine. Just make sure you set the $numObjs variable to the number of boid objects in your scene.


Last edited by Dann; 28-10-2006 at 09:40 AM.
# 3 28-10-2006 , 10:25 AM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095
thx buddy!! I asked a friend of mine who has no idea about mel but is a c++ programmer. he threw this together for me - after 10 minutes only. it´s working too.

thx for your effort. I´ll study both codes. life is hard without mel...





for ($counter = 1; $counter <= 200; ++$counter)
{
$object_a = "boid_" + $counter;
eval select -r $object_a;


$object_b = "mackerel_anim" + $counter;
eval select -add $object_b;

pointConstraint -offset 0 0 0 -weight 1;

orientConstraint -offset 0 0 0 -weight 1;


}


everything starts and ends in the right place at the right time.

Last edited by Falott; 28-10-2006 at 10:29 AM.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads