Spin


#1

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…


#2
  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!! :smiley:


#3

Originally posted by mark_wilkins
P.S. Sounds like you need a certain textbook!! :smiley:

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:


#4

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.


#5

ok, here’s the MEL script:

nurbsCube;

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

duplicate;
rotate 0 $x 0;

}


#6

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


#7

Mark: when you duplicate, don’t you end up with both the original and the new object selected?

nope, only the new one.

– mark


#8

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…


#9

no, because by default rotate provides an absolute rotation.

However, one could replace

rotate 0 $x 0;

with

rotate -r 0 10 0;

– Mark


#10

'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…


#11

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.


#12

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.