Sunday, February 3, 2013

Rotating object using mel script

                             Adding Mel Script to your object is easy way to animate it. Go through the Maya documentation and you can learn it easily. Now lets see how to rotate your object using Mel Script.
                             Go to Attribute Editor(ctrl+a) right click on the rotate X value. Click Create New Expression. Then type this script and click create(pCylinder1 is the name of my model).

                 Now play it. You can see your object is rotating alone X axis. Change 100 to higher value and it will increase rotating speed of your model. Change X to Y or Z to change rotating axis.

                              Adding throttle Attribute to your object to control speed.

                 Select your object and Click Modify->Add Attribute. Enter following values.
                                                              Long name=throttle
                                                              Data Type=float


                       Click OK. Now you can see throttle attribute in your Attribute Editor. Go to Expression Editor and Change the script.

               Change the value of throttle while playing your animation. See the result. You can use this method for Helicopter Rotor or Boat Propeller or something.

No comments:

Post a Comment