Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 1 19-02-2013 , 07:07 PM
Registered User
Join Date: Feb 2013
Posts: 2

Repeat function in an expression

Hi Guys,
I am trying to write an expression for a project. So far I have the following:

magnet1.magnitude = 0;
if (gear.rotateY >360)
magnet1.magnitude = -20;

As you can see I have an object called magnet1 which I set to magnitude 0 then when the gear object
rotates to one full rotation it triggers the magnet (a Radial force)
This works well, my question is how do I continue the expression to make the magnet trigger
everytime the gear rotates 360 degress ?
Such as a trigger pulse each rotation of the gear.

Thanks Tony

# 2 19-02-2013 , 08:35 PM
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
There's a few ways to approach it. These might not be the most elegant, but depending on the situation, it should work.
1) Reset the gear rotate. If gear.rotateY is 360 or more, set to 0.
2) Create a variable or attribute instead of hardcoding 360. If gear.rotateY is greater than the variable (which starts at 360) add 360 to the value you're testing against.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads