View Full Version : Spin

 Linker05 May 2003, 10:38 PMI beguin today Mel ;( I seek to make spin a cube to a loop on 360° by increment of 30°deg. On ligntwave I make ' main { copy (); // com. copier for (\$x=10; \$x<360; \$x+=10) //loop 360° by increment 10° { rotate (10, "Y"); // rotate on 10 ° paste (); } } But I dont know with Mel....
mark_wilkins
05 May 2003, 02:47 AM
1) Make a cube and rename it cube.

2) Open the Expression Editor

3) Enter the following expression:

cube.ry = frame * 10;

-- Mark

P.S. Sounds like you need a certain textbook!! :D

Hugh
05 May 2003, 03:03 AM
Originally posted by mark_wilkins
P.S. Sounds like you need a certain textbook!! :D

I think you're right there.....

I'd have to recommend one:

Complete....

sorry, sorry.... my mistake...

MEL Scripting for Maya Animators

I can't remember who it's by, though - but I'm sure a search on Amazon will bring it up.....

:thumbsup:

05 May 2003, 05:05 AM
Thx for ur reponse and now I discovered Expression Editor but it wasn't this.
I want my cube duplicate all 10° deg on 360.

MEL Scripting for Maya Animators, I heard some speak but actually i beguin and i have only the docs of Ple.

mark_wilkins
05 May 2003, 07:43 AM
ok, here's the MEL script:

nurbsCube;

for (x = 0; x < 360; x += 10) {

duplicate;
rotate 0 \$x 0;

}

Hugh
05 May 2003, 10:58 AM
Mark: when you duplicate, don't you end up with both the original and the new object selected?

if I may suggest a slight modification to your script:

\$newNurbsCube = `nurbsCube`;
\$myNurbsCube = \$newNurbsCube[0];

for(\$x = 0; \$x < 360; \$x += 10)
{
select -r \$myNurbsCube;
duplicate;
rotate 0 \$x 0;
}

mark_wilkins
05 May 2003, 11:25 AM
Mark: when you duplicate, don't you end up with both the original and the new object selected?

nope, only the new one.

-- mark

Hugh
05 May 2003, 11:36 AM
Ah yes - of course....

sorry 'bout that....

in which case, shouldn't the line be:

rotate 0 10 0;

as otherwise you'll be getting exponentially larger rotations from the base position....

mark_wilkins
05 May 2003, 12:55 PM
no, because by default rotate provides an absolute rotation.

However, one could replace

rotate 0 \$x 0;

with

rotate -r 0 10 0;

-- Mark

Hugh
05 May 2003, 01:16 PM
'doh

Of course - you're right..... (there shouldn't have been any doubt!)

I've been so used to always using rotate -r that I didn't notice it wasn't there in yours....