|
|
Hi RusHHouR!
RusHHouR wrote:
> And the word "macro" scares me.
No need for that! It's really not too hard. Try this:
---%<---
/* We need a random seed if we want to use rand() */
#declare Seed = seed(54890);
#declare Stone = /* Your stone object here */
#macro Rotated_Stone()
/* Create a vector with random components (within 0 and 1) */
#local Random_Vector = <rand(Seed),rand(Seed),rand(Seed)>;
/*
Until now, the random vector has components from 0..1,
we need them to go from -1 to 1. We subtract 0.5 (then
it goes from -0.5 to 0.5 and double it, and multiply it
by the maximum amount of rotation we want, here 10
degrees.
*/
#local Random_Degrees = (Random_Vector - 0.5)*2*10;
object {
Stone
rotate Random_Degrees
}
#end
/*
Now everywhere you've used object { Stone } before just use
object { Rotated_Stone() }
*/
--->%---
Should work, although I haven't tested it :)
HTH,
Florian
Post a reply to this message
|
|