|
|
netquest wrote:
>Hello,
>
>I'm in the process of creating a number of basic objects using the *declare*
Roughly speaking,
#declare Xcount = -5;
#while (Xcount < 5)
#declare Zcount = -5;
#while (Zcount < 5)
#if(rand(RObjects) > 0.5)
object { ArrayOfObjects[floor(10*rand(RObjects))] }
#end
#declare Zcount = Zcount + MaxSize;
#end
#declare Xcount = Xcount + MaxSize;
#end
Of course, over the area you want, and you could use #switch instead of an
array, but basically, iterate over the two axis in steps big enough to avoid
a collision, and choose randomly whether or not to place an object.
For a less grid-like look, you could iterate in steps of twice-maxsize and
place an object at xcount,zcount +/- maxsize, (or combine the two randoms -
randomly place an object or not, randomly placed near the current point).
You get the idea, I hope. Don't forget to seed() your randoms and initialize
your array and so on.
--Chris
Post a reply to this message
|
|