PDA

View Full Version : Spin


Linker
05-23-2003, 11:38 PM
I 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-24-2003, 03: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-24-2003, 04: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:

Linker
05-24-2003, 06: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-24-2003, 08:43 AM
ok, here's the MEL script:


nurbsCube;

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

duplicate;
rotate 0 $x 0;

}

Hugh
05-24-2003, 11: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-24-2003, 12:25 PM
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-24-2003, 12:36 PM
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-24-2003, 01: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-24-2003, 02: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....

Linker
05-24-2003, 03:43 PM
Thanx all and mark_wilkins, I understand errors in my script, I forgot the {} ;(

you need a certain textbook Yes, sure I need to buy a good book on Mel.

CGTalk Moderation
01-15-2006, 06:00 AM
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.