Substance Painter
In this start to finish texturing project within Substance Painter we cover all the techniques you need to texture the robot character.
# 1 12-08-2007 , 09:35 AM
Subscriber
Join Date: Aug 2004
Posts: 23

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.

# 2 12-08-2007 , 10:13 AM
happymat27's Avatar
Subscriber
Join Date: Jul 2004
Posts: 1,257
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.

# 3 12-08-2007 , 10:16 AM
Subscriber
Join Date: Aug 2004
Posts: 23
cool, i'll give it a wurl... de dum tish... lol

# 4 12-08-2007 , 10:24 AM
Subscriber
Join Date: Aug 2004
Posts: 23
Yeah that works, cheers for your help.

# 5 12-08-2007 , 10:54 AM
Subscriber
Join Date: Aug 2004
Posts: 23
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.

# 6 12-08-2007 , 08:17 PM
Xander-0's Avatar
Registered User
Join Date: Feb 2005
Location: This Place
Posts: 220
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

https://X4nd5r.deviantart.com
# 7 12-08-2007 , 09:28 PM
Subscriber
Join Date: Aug 2004
Posts: 23
Cool, thanks...
I'll give it a go.

# 8 12-08-2007 , 09:44 PM
Subscriber
Join Date: Aug 2004
Posts: 23
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

# 9 12-08-2007 , 09:48 PM
Subscriber
Join Date: Aug 2004
Posts: 23
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.

# 10 12-08-2007 , 10:00 PM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
Matt, you have been pushing that graoh editor lately user added image 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
# 11 12-08-2007 , 10:19 PM
happymat27's Avatar
Subscriber
Join Date: Jul 2004
Posts: 1,257
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 user added image

Take it easy,

Mat.


Last edited by happymat27; 12-08-2007 at 10:22 PM.
# 12 13-08-2007 , 12:34 PM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
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.., user added image


take it easy and life will be easy
# 13 14-08-2007 , 05:21 PM
Xander-0's Avatar
Registered User
Join Date: Feb 2005
Location: This Place
Posts: 220
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

https://X4nd5r.deviantart.com
# 14 14-08-2007 , 06:10 PM
mirek03's Avatar
Subscriber
Join Date: Feb 2006
Location: Australia
Posts: 2,752
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
# 15 15-08-2007 , 04:00 PM
Xander-0's Avatar
Registered User
Join Date: Feb 2005
Location: This Place
Posts: 220
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, 396 views)

Book Wise

https://X4nd5r.deviantart.com
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