Substance Painter
In this start to finish texturing project within Substance Painter we cover all the techniques you need to texture the robot character.
# 1 14-12-2008 , 11:39 AM
bendingiscool's Avatar
Subscriber
Join Date: Jul 2006
Location: London
Posts: 567

select random object in selection

Hey, ok this should be dead simple, but I can't work out the syntax.

Basically I want to be able to be able to select a bunch of geometry, cubes, cylinders, etc, then go through a loop randomly instancing one of them each time through.

So far I have...

string $sel[] = `ls -sl`;

for ($i=0; $i<10; $i++)
{
select $sel[1];
instance;
}

now this is just going to select a specified object from the selection, what I want is to be able to select a random object of the selection each time it loops through.

Many thanks, Chris

# 2 16-12-2008 , 08:45 AM
t1ck135's Avatar
Registered User
Join Date: May 2004
Location: UK
Posts: 1,991
check out rand() in the documentation
you'll be able to grab a random value in the range of (in your example) 0 to 10 and use that in the select statement

if I had maya installed (learning the slightly cheaper blender at the minute) then I'd modify your code to get it working but you should be able to figure it out easily enough.

Si


Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
www.flash-fx.net
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