Digital humans the art of the digital double
Ever wanted to know how digital doubles are created in the movie industry? This course will give you an insight into how it's done.
# 1 22-12-2008 , 04:18 AM
bendingiscool's Avatar
Subscriber
Join Date: Jul 2006
Location: London
Posts: 567

incrementing variables in loops

Hey, so there a way to create incremented variables inside of loops, for instance...

///////////////////
// select some objects
string $selObjects[] = `ls -sl`;

// loop through items in selection and store their bounding box info
for ($i=0;$i<$selObjects;$i++)
{
float $agentBBox[] = `xform -q -ws -boundingBox ("object_" + $i)`;// cylinder's BBox
}
//////////////////
This will store each objects bounding box once and then overwrite it the next time it goes through the loop, what I would like to do would be to create a new float array each time it goes through the loop.

Many thanks, Chris

# 2 22-12-2008 , 11:37 AM
BennyK's Avatar
Registered User
Join Date: Oct 2007
Location: IL
Posts: 738
Not sure about that but I think you have to define the array outside the loop. Have a look into this.
Benny


When in doubt, delete history and freeze transformations.

My latest snake game
(Requires DirectX9 SDK and Framework)
# 3 22-12-2008 , 06:34 PM
vladimirjp's Avatar
Subscriber
Join Date: Jun 2003
Location: stuck in the 90's boston, USA
Posts: 1,871
u can create on array outside the loop and store incrementally a bounding box property in each element. u dont have to create a new array each time.

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