SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Programming / Rotating faces randomly

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
 
Thread Tools
24-09-2007, 07:58 PM   #1
Nirmal_c
Registered User
 
Join Date: Feb 2007
Location: India
Posts: 28
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
  Reply with quote
21-10-2007, 06:59 AM   #2
BennyK
Registered User
 
BennyK's Avatar
 
Join Date: Oct 2007
Location: IL
Posts: 738
I suggest you'll look through Maya help for Mel language first.
http://www.highend3d.com/maya/tutori...g-MEL-264.html
  Reply with quote
23-02-2008, 07:50 AM   #3
Weyu
Registered User
 
Weyu's Avatar
 
Join Date: Nov 2006
Location: Sweden
Posts: 482
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.

Last edited by Weyu; 25-02-2008 at 10:16 AM.
  Reply with quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
replace faces with vertices? Darkware Maya Basics & Newbie Lounge 3 21-07-2013 05:08 AM
Cut faces tool issue... LadySekhmet Maya Basics & Newbie Lounge 3 14-03-2009 04:24 AM
how come i dont have a keep faces planar option? Chirone Maya Basics & Newbie Lounge 0 14-01-2008 08:42 AM
why have faces of 4 edges only? Chirone Simply Maya Tutorials 3 26-12-2007 11:33 PM
Don't know how to scale multiple faces. Darkware Maya Modeling 6 30-12-2002 08:00 PM