Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 27-01-2003 , 02:52 AM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172

Dynamically driven gears.

I'm trying to animate a simple gear scene with dynamics, but can't get it to work. I have four gears all the same size and want them to rotate. I was thinking I could make three of them active rigid bodies with hinge constraints and have the other gear be a passive rigid body and simply rotate it, which in turn would rotate the others, but I cannot add an expression or key the rotate Y on the passive body. I tried breaking the connection, which usually works in most cases, but you apparently cannot do this when you're dealing with a rigid body. I know I could key all the gears, but it seems as though there should be a way to do it with dynamics. Any suggestions?

# 2 28-01-2003 , 06:00 AM
Registered User
Join Date: Nov 2002
Location: Philippines
Posts: 136
Hi, Just a thought, if all the gears are the same size, and all rotations are the same speed, you could set it up with set driven keys instead of dynamics. Have the first gear as the driver, then all the other gears as driven. Just set it up so that if the first rotates clockwise (+value) then the next rotates counterclockwise (-value) and so on. Then all you have to do is key the first gear and the rest should follow.

Back to dynamics, you could try setting Passive Keys. Under the Soft/Rigid Bodies Menu you can set Passive keyframes for passive rigid bodies.

Hope this helps
user added image

# 3 28-01-2003 , 09:22 PM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
The set driven kay would probably be the best thing. I had forgotten about that. I actually did figure out how to set keys for the passive rigid body and everything worked. The only problem was that the gears didd not look right when they turned and sometimes one would fly away from its position for no apparent reason. But yes, I will do the set driven key thing. Thanks a lot Calvin!

# 4 28-01-2003 , 10:47 PM
ragecgi's Avatar
Registered User
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
I'm not quite familiar with constraints, but couldn't you put a "nail" constraint in the pivot of each gear to keep the rigids in place while the colisions are happening?

I kind of agree that setDriven keys are the best and easiest way to go tho....


Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
# 5 29-01-2003 , 12:15 AM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
I used a hinge constraint, which allowed them to rotate properly, but they flew away from the constraint sometimes for no reason at all, which should not have happened.

# 6 29-01-2003 , 01:38 AM
Registered User
Join Date: Nov 2002
Location: Philippines
Posts: 136
Glad I could help Darkware! I always say Set Driven Key is your best friend in MAYA...


user added image

# 7 29-01-2003 , 11:41 PM
ryan_godridge's Avatar
Registered User
Join Date: Jan 2003
Location: Brighton UK
Posts: 13

Dynamically driven gears.

Hi Darkware,

You might like to try the howto on the AW site that uses the particle system to drive a gear which then drives a further gear.

I got it going with the first driving a second and then driving a third gear, great fun, all done with dynamics.

I had the same problem of gears flying off but in the end a bit of tweaking solved it all.

It's on AW 'community' 'howtos' 'dynamics howtos' - I've not given you a link cos it looks a bit like it's got sessionid info in.

Cheers

Ryan

# 8 30-01-2003 , 04:39 AM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
Well, I was having too much trouble with set driven keys, so I chose a different path. I have decided to not use dynamics at all since they are turning out to be quite unreliable as far as animating gears go. I decided to use expressions, which gives me a perfect animation with no errors at all. I have 9 gears and can animate them all by rotating only one. What I am wanting to do now is make these gears rotate three wheels. Easy enough - just create a wheel for three gears and parent them to the specified gears. Here's the hard part. I want these wheels to turn a track. One similar to a walking machine, or more specifically - the tracks of a tank. This would be easy if the tracks went in a circle, but thet don't obviously. I'd like for the tracks to be made up of a bunch of flat cubes (rectangles actually) and have them rotate around so it looks like one big track. I want this to be linked via expressions to gear1, which is the gear that drives everything else. Is this even possible?

# 9 30-01-2003 , 04:48 AM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
Here are the expressions used for the gears for those who care to know.....

(odd numbered gears)
Expression for gear2 - gear2.rotateX = -gear1.rotateX;
Expression for gear4 - gear4.rotateX = -gear1.rotateX;
Expression for gear6 - gear6.rotateX = -gear1.rotateX;
Expression for gear8 - gear8.rotateX = -gear1.rotateX;

(even numbered gears)
Expression for gear3 - gear3.rotateX = gear1.rotateX;
Expression for gear5 - gear5.rotateX = gear1.rotateX;
Expression for gear7 - gear7.rotateX = gear1.rotateX;
Expression for gear9 - gear9.rotateX = gear1.rotateX;

Fairly simply, see. The difference between the expressions for the odd and even gears is the negative and positive value for gear1.rotateX. Works like a charm.

EDIT* - Also, I plan to include larger and smaller gears. I figure I can link these to gear1 through expressions the same way. All I have to do is multiply gear1.rotateX by a number for a faster or slower rotation. (bigger gears will have to rotate faster, while smaller gears will have to rotate slower) I'm learning slowly but surely. user added image


Last edited by Darkware; 30-01-2003 at 04:51 AM.
# 10 30-01-2003 , 06:21 AM
Registered User
Join Date: Nov 2002
Location: Philippines
Posts: 136
Darkware, what trouble did you have with the SetDriven Keys? I've done the gear thing before and I usually get it to work in a few minutes as long as the gears are already built. Also, looking at the expressions, that's exactly what SDK does for you.

user added image

# 11 30-01-2003 , 06:30 AM
ragecgi's Avatar
Registered User
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
With the tread issue, I saw a tut somewhere, sorry can't remember where, but it talked about parenting the tracks to a simple circle, and deform the track/circle combo to the shape you want via a lattice, and the tracks were animated by the driver of the circle rotation within the lattice.

Sorry... does that make any sense?


Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
# 12 30-01-2003 , 11:31 AM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
That helps. I've never used lattices before, so I guess I'll dive into that.

About SDK's. I just couldn't get it to work quick. I fiddled around a bit, but no results. I'll have to take some time out and relearn how to do them again I guess. Another reasons I didn't choose SDK's was because it's harder to do a continuous animation. With the last tut I did, you could increase or decrease a single value to drive everything. The drawback however, was that this value could only be increased or decreased to -10 or 10. This makes it difficult to animate gears because they don't just rotate from -360 to 360 degrees. With expressions I knew all I had to do was rotate gear1 as much as I wanted and had no limit.

Can you do what I've done with expressions with SDK's? Because if you can, I'll try that out. Thanks for all the help again.

# 13 31-01-2003 , 02:00 AM
Registered User
Join Date: Nov 2002
Location: Philippines
Posts: 136
Ok, here goes... Don't think I don't like expressions, but I'm just a big proponent of SDK's. user added image

Assume you have 2 gears. Gear 1 is the driver, gear 2 is the driven. Load them both appropriately then select rotate X for both of them. Now hit the Key button in the SDK window. Select your first gear then rotate it 360 on X. Then select the second gear and rotate it -360 on X. Then hit Key again.

Now, set your keyframes on the X rotation of the 1st gear. Then go to the graph editor. Select the graph for the X rotation of the 1st gear then go to Curves > Post Infinity >Cycle. The animation should go on for ever and ever and ever....

To adjust the speed, just adjust the keyframes on Gear1, and the rest should follow.

Ok, so maybe SDK doesn't do EXACTLY what your expression does on it's own, but it does with a little help from Infinity Curves

Hope this helps some more. user added image

user added image

# 14 31-01-2003 , 03:35 AM
Darkware's Avatar
Subscriber
Join Date: Oct 2002
Location: USA
Posts: 1,172
Izzy! That works perfectly! I figured out how to do it in mere seconds! You take a circle and a cube and position the cube on the edge of the circle. You then parent the cube to the circle so it moves with the rotation of the circle. Select both, then create a latice. Scale the lattice out, then scale the circle in for proper deformation with you rotate it, and walaa! The only problem I see right now is that the cube is being deformed too much. I'm sure if I play around with it enough I can get it perfect. Maybe increase the lattice size and decrease the circle - I don't know, I've just worked with it a few seconds.

Calvin, thanks again! I see what I was doing wrong the first time with SDK's. If you have Alias|Wavefront's Character Rigging and Animation book, you have probably gone through the chapter where you set up the animation of fingers with SDK's. The driver was a slider of some sort on a locator and the driven was the finger joints. This is what threw me off. For some reason I thought you were not able to use the rotation of an object for the driver. I only knew about the slider thing the chapter went over. Anyway, thanks for clearing things up!

Izzy - just thought of something. I wonder what would happen if I only put the circle in the lattice. You think that would still work? If it did, the cube would still move with the circle, but would not be deformed at all, which is good. *two minutes later* Nope. Didn't work. The cube rotates with the original form of the circle before it was put in the lattice. Oh well, I'll just play around some more and see what I can come up with.

# 15 31-01-2003 , 03:59 AM
Registered User
Join Date: Nov 2002
Location: Philippines
Posts: 136
Again, Glad to help. I think I'll try that thing with the circle and lattice too...

:banana:

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