Slight random rotation

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 02 February 2008   #1
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.

Thanks
 
Old 02 February 2008   #2
Hi.

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...
__________________
http://www.creativecrash.com/users/sublist/contributions?tab=free_downloads

Last edited by GiantG : 02 February 2008 at 02:17 PM.
 
Old 02 February 2008   #3
Perfekt!

Thank you so much.
 
Old 02 February 2008   #4
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 = locator.windows *(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.
 
Old 02 February 2008   #5
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.
 
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 07:18 PM.


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