geometry grid randomisation
I was going through the 'artists guide to mel' training from dt the otherday and found the really handy little loop that can make grids of geometry.
Heres the script... int $i; int $j; for ($i=0;$i<5;$i++){ for ($j=0;$J<5;$j++){ polyCube; move -r (2*$j)0(2*$i); } } I was wondering how I would go about randomising their size on creation so that I could have random size cubes etc be produced. Chris |
Here you go Chris, slightly modified code adding in a random number generator and applying it to the polyCube command to set the scale. Commented so people can follow it :)
Code:
int $i; Code:
// function that creates a 5x5 grid of randomly sized cubes As an exercise it'd be good to modify the function so that it generates another set of cubes to the right or left of the previous one. Up to you though ;) Simon |
Hey Si
Ive not used ramdom in MEL, is it actually random so to speak (say in delphi you set a random number and unless you set the clock its always the same as its always produced in the same clock cycle)?? Like I say I've never used it so cant comment. |
Hi Steve,
It gives a different result each time so can be called random. If you look into how it is seeded then with some hardcore maths it might be possible to predict the variance but thats way over the head of us mere mortals ;) Simon |
All times are GMT. The time now is 08:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018