Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Rotating faces randomly (https://simplymaya.com/forum/showthread.php?t=27601)

Nirmal_c 24-09-2007 07:58 PM

Rotating faces randomly
 
Hi
I am very new to mel commands,
I have split my polygon faces in to single pieces.now i have more the 1000 faces.
I want to animate them randomly (transformer effect) and combine to the shape. I cant do it manually. So some one help me how to rotate and transform all the faces on their local axes randomly .

Waiting for someones reply

BennyK 21-10-2007 06:59 AM

I suggest you'll look through Maya help for Mel language first.
http://www.highend3d.com/maya/tutori...g-MEL-264.html

Weyu 23-02-2008 07:50 AM

I just started learning MEL and I came across this script on cgtalk, maybe it can give you a clue at least.

Going to try it when I get home.

{
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`;
}
}

Remember to change "float $RandomValue = .5;" to a number that is good for you- and I'm not certain that you need " string $obj[] = `ls -sl`;"

And have in mind that "// setAttr ($obj[$i] + ".rotateZ") `rand $RandomValue`;"
was writen like that becouse he didnt want it to rotate in the Z axis so just remove those slashes to active the Z axis to.

Good luck. :)

Edit: And Benny have in mind that you need to know MEL to make scripts but not to copy them so just ask for help and things like this can be done.

You should be able to key it like usual to animate it.

Second edit: I tried the script and it worked perfectly just copy paste and change your attributes, it worked good when keyed to. :)


All times are GMT. The time now is 08:59 AM.

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Simply Maya 2018