Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Dynamics & Special Effects (https://simplymaya.com/forum/forumdisplay.php?f=33)
-   -   Dynamically driven gears. (https://simplymaya.com/forum/showthread.php?t=3531)

Darkware 27-01-2003 02:52 AM

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?

Calvin 28-01-2003 06:00 AM

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
:beer:

Darkware 28-01-2003 09:22 PM

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!

ragecgi 28-01-2003 10:47 PM

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....

Darkware 29-01-2003 12:15 AM

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.

Calvin 29-01-2003 01:38 AM

Glad I could help Darkware! I always say Set Driven Key is your best friend in MAYA...


:beer:

ryan_godridge 29-01-2003 11:41 PM

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

Darkware 30-01-2003 04:39 AM

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?

Darkware 30-01-2003 04:48 AM

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. :P

Calvin 30-01-2003 06:21 AM

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.

:cool:

ragecgi 30-01-2003 06:30 AM

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?

Darkware 30-01-2003 11:31 AM

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.

Calvin 31-01-2003 02:00 AM

1 Attachment(s)
Ok, here goes... Don't think I don't like expressions, but I'm just a big proponent of SDK's. :)

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. :beer:

:D

Darkware 31-01-2003 03:35 AM

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.

Calvin 31-01-2003 03:59 AM

Again, Glad to help. I think I'll try that thing with the circle and lattice too...

:banana:


All times are GMT. The time now is 12:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018