Slight random rotation

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  02 February 2008
Slight random rotation

I've never really had a chance to use MEL, so please forgive me if this is a bit simple, but i can't figure it out (in the short amount of time I have).

I want to randomise, just slightly, the rotation of a few hundred simple 4-sided poly planes which represent glass panels so they'll pick up reflections in a more natural way.
Is there a simple way to do this?
They're currently separate objects, but once their rotation has been altered I'll be combining them.
Each pane is around 4 units high, and I only need to rotate them through X and Y, probably by no more than 0.5 - I don't need to rotate them through Z.
Here's an image, with units shown, in case it helps:

Should this be as simple as I think it should be?

Any help appreciated.

  02 February 2008

try this.

Select all you Objects and run this:

  string $obj[] = `ls -sl`;
  float $RandomValue = .5;
  for ($i=0; $i < size($obj);$i++)
 	 setAttr ($obj[$i] + ".rotateX") `rand $RandomValue`;
 	 setAttr ($obj[$i] + ".rotateY") `rand $RandomValue`;
 	 // setAttr ($obj[$i] + ".rotateZ") `rand $RandomValue`;

you can play with the RandomValue to increase the randomness
Take care of your pivot...

Last edited by GiantG : 02 February 2008 at 02:17 PM.
  02 February 2008

Thank you so much.
  02 February 2008
I was also thinking about this and I was curious if you were doing any animation with this structure. Because I was thinking that you might also be able to make a locator or something to select that you could create an attr channel, on so that you could control the open and closing of these windows in groups, or all at once.

polyObject.rx = *(rand($randvalue)

With that I will play around with it some. But the whole purpose of that is for you to be able to control the degree in which the windows are opening, which would be affected by the time of day. As well as weather conditions.
  02 February 2008
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 01:57 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.