Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 12-08-2007, 10:35 AM   #1
diggersworld
Subscriber
 
Join Date: Aug 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Constant Rotation

Hey I been using Maya for a while now, but have never really gone into the animation side of it, not to keen on rigging, setting up weights and all that jazz.

Anyway, I would like to know if there's a way that you can take an object and make it rotate on its own central pivot, without having to key it every so many frames.

E.g. A fan turning round continuously in a clock wise, or anti-clockwise direction.

Thanks in advance for anyone who comments.
diggersworld is offline   Reply With Quote
Old 12-08-2007, 11:13 AM   #2
happymat27
Subscriber
 
happymat27's Avatar
 
Join Date: Jul 2004
Posts: 1,257
Thanks: 0
Thanked 3 Times in 3 Posts
Default

hello there diggersworld,

there's a simple sollution to your question and it's cycle with offset your animation curves. Basically all you need to do is key the start and end frame of your rotation...........

Say you wanted a fan to rotate 5 times a second @25fps, you'd key frame 1 then rotate it 360 degrees and key frame 5 (5x5=25).

Next, with the rotating object selected, open up the graph editor (Window > Animation Editors > Graph Editor), you'll see the animation curve as a straight line (if you can't just hit the 'a' key).

The default for an animation curve's infinity setting is constant, this means that before the first and after the final key the curve is at a constant value, go to the view menu in the graph editor and hit infinity to see this. All you need to do is change the post infinity setting to Cycle with Offset (Curves > Post Infinity > Cycle with Offset) and your object will rotate forever.

I hope my rambling helps,

Mat.
__________________
Click here to visit my site
happymat27 is offline   Reply With Quote
Old 12-08-2007, 11:16 AM   #3
diggersworld
Subscriber
 
Join Date: Aug 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

cool, i'll give it a wurl... de dum tish... lol
diggersworld is offline   Reply With Quote
Old 12-08-2007, 11:24 AM   #4
diggersworld
Subscriber
 
Join Date: Aug 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah that works, cheers for your help.
diggersworld is offline   Reply With Quote
Old 12-08-2007, 11:54 AM   #5
diggersworld
Subscriber
 
Join Date: Aug 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay sticking with this topic but taking it further... is there a way that i can make a controller so that i can control the speed at which it rotates....

i.e. like on a stationary hover craft, the fans may rotate slowly but not enough to push it along, but when accelerated (rotated faster) it begins to move.

So in other words, a controller that alters the Rotations of the object.
diggersworld is offline   Reply With Quote
Old 12-08-2007, 09:17 PM   #6
Xander-0
Registered User
 
Xander-0's Avatar
 
Join Date: Feb 2005
Location: This Place
Posts: 220
Thanks: 0
Thanked 2 Times in 1 Post
Default

yes, there is.
This is the way I'd set it up (dunno if its the best way, but its how I'd do it)
Oh - and I don't exactly remember all the commands in here, but this is close.

Part one - attribute setup

First, create a new attribute in for your fan blade. Right click on the channel box (where the attributes for translate/rotate/scale are). Click 'add attribute'.
name it something like 'rotation speed'. Make sure its a double, and don't give it any upper or lower bounds (well, if you want your fan to only rotate in one direction, set it to have a minimum of '0').
Then, select the axial attribute that the fan will rotate around (by default, for cylinders, this is the 'y' axis). Right click it, and select 'expressions'. You'll need to add the following command (or something similar);
"fan.rotateY = 360 * fan.rotation_speed * (frame/24);"
(or something like that - I'm a little bit fuzzy about the frame variable at the moment). Anyways, if you set rotation speed to 1, the fan will rotate once in 24 frames (24 or 30 frames is generally standard for movie and tv work).
Now, if you want to, that's all you need to do.

There is a second part, however, that allows you to set up a visual control.

First, you need to do the steps specified above (even some of them aren't strictly necessary with the rest of this setup, its still nice to be able to see the output).

then, you'll need two nurbs curves. actual shape doesn't matter, although I'm going to reccommend two straight lines. stick them into the heriarchy for your controls, just before the fan blade itself. Move them into position near your fan, and make sure to label them (say, fan speed control and control slider).
Freeze their transformations (so that they think they're at (0,0,0)).
geometry constraint the speed control to the slider (or do this, then name them) (this will make it 'stick' to the curve, as seen with motion paths, but here you can still move the other curve.).
Now, normally, your speed control wll have moved (and possibly rotated) itself. for ease of use, you usually want it to be perpendicular to the curve it 'rides' - mess around with the 'tangent' directions until you get this. Then, move it to either one end (if your speed will only be positive) or to roughly the middle (if you can have both positive and negative speeds). Then, freeze the transformations of the speed slider again (so that it again thinks its at zero).

Next, we need to set up an expression to make the control talk to the fan itself. This is also a good way to limit the speed of your fan.

Go back to your fan, select the attribute we created earlier, right click it, and select 'expressions'.
add the following expression (or something similar);
"fan.rotation_speed = 100 *fan_speed_control.translateX;"
(About this statement - I'm assuming a number of things here for the example - 1) your control slider curve is 1 unit long from the '0' point, and you want your fan to rotate at a max of 100 rpf. 2) the way you set up your slider is roughly parallel to the ground plane, and pointing along the x-axis).
click 'add', and you're done!

That's that kind of setup in a nutshell.
__________________
Book Wise

http://X4nd5r.deviantart.com
Xander-0 is offline   Reply With Quote
Old 12-08-2007, 10:28 PM   #7
diggersworld
Subscriber
 
Join Date: Aug 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cool, thanks...
I'll give it a go.
diggersworld is offline   Reply With Quote
Old 12-08-2007, 10:44 PM   #8
diggersworld
Subscriber
 
Join Date: Aug 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

K... having a bit of trouble...

How do I make sure that the new attribute I'm adding is a double?

Also, I carried on assuming is was, and got this error when trying to add the expression:

Error: Attribute already controlled by an expression, keyframe, or other connection: fan.rotateZ
diggersworld is offline   Reply With Quote
Old 12-08-2007, 10:48 PM   #9
diggersworld
Subscriber
 
Join Date: Aug 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh no... tried it again, and got it working this time... Hurray!!

Cool thanks man... I'll try the controller now, but it'd no biggy if that don't work.
diggersworld is offline   Reply With Quote
Old 12-08-2007, 11:00 PM   #10
mirek03
Subscriber
 
mirek03's Avatar
 
Join Date: Feb 2006
Location: Australia
Posts: 2,752
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Matt, you have been pushing that graoh editor lately can you think of an easier way to control the speed.., I was thinking set driven key.., but its been so long since Ive used it??
__________________
take it easy and life will be easy
mirek03 is offline   Reply With Quote
Old 12-08-2007, 11:19 PM   #11
happymat27
Subscriber
 
happymat27's Avatar
 
Join Date: Jul 2004
Posts: 1,257
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Awwww, I just made a little tutorial to show how to do this and Xander-O beat me to the explanation!

Mirek: The graph editor is a really simple visualisation of your animation. Setting the infinity curve to cycle with offset is the easiest way answer the first part of diggersworld's query. Using the graph editor to deal with the second query, it's possible to control the speed manually but it's not possible to control the value of a key through SDK's.

Top explanation Xander

Take it easy,

Mat.
__________________
Click here to visit my site

Last edited by happymat27 : 12-08-2007 at 11:22 PM.
happymat27 is offline   Reply With Quote
Old 13-08-2007, 01:34 PM   #12
mirek03
Subscriber
 
mirek03's Avatar
 
Join Date: Feb 2006
Location: Australia
Posts: 2,752
Thanks: 0
Thanked 3 Times in 3 Posts
Default

ummm yes great explanation.., and.., I do know what a graph editor is.., just wondered if there was more than one way to skin a cat by influence rather than expression but I guess I was wrong..,
__________________
take it easy and life will be easy
mirek03 is offline   Reply With Quote
Old 14-08-2007, 06:21 PM   #13
Xander-0
Registered User
 
Xander-0's Avatar
 
Join Date: Feb 2005
Location: This Place
Posts: 220
Thanks: 0
Thanked 2 Times in 1 Post
Default

ehh.... thanks, I guess.

I really had to get into how to write control expressions when I was figuring out how to do tank treads and a bunch of other stuff (like expanding joints).
__________________
Book Wise

http://X4nd5r.deviantart.com
Xander-0 is offline   Reply With Quote
Old 14-08-2007, 07:10 PM   #14
mirek03
Subscriber
 
mirek03's Avatar
 
Join Date: Feb 2006
Location: Australia
Posts: 2,752
Thanks: 0
Thanked 3 Times in 3 Posts
Default

now that would be interesting.., how DO you do tank treads, is there a tut, I have a script but Id ig to know how it is done.., maybe ill look over what you wrote again and dissect it.
__________________
take it easy and life will be easy
mirek03 is offline   Reply With Quote
Old 15-08-2007, 05:00 PM   #15
Xander-0
Registered User
 
Xander-0's Avatar
 
Join Date: Feb 2005
Location: This Place
Posts: 220
Thanks: 0
Thanked 2 Times in 1 Post
Default

ummm... the problem is I know how to control them, but I don't have a good way to set them up yet (another one of my many projects is to write the scripts for a setup).

I have some old notes that I made for myself for creating the treads - mostly, it gives the equations and what each piece is, but it doesn't tell much about setup. (because, of course, I knew it) urgh. Anyways, maybe this helps?

I know there are scripts out there that both setup and control creation of tank treads, but they always struck me as problematic in two ways - 1) there usually weren't many choices you could make during creation about things, and 2) control options were also rather limited. Mostly I set this up so I'd have a manual control of the treads, instead of only a entered value.
Attached Files
File Type: txt tread notes.txt (2.1 KB, 63 views)
__________________
Book Wise

http://X4nd5r.deviantart.com
Xander-0 is offline   Reply With Quote

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.