I am facing a weird issue concerning rigging with maya. My head is stuck maybe the solution is right in front my eyes.
What i am trying to achieve is to connect the rotation X of one object with the rotation Z of another with driven keys.
So when rotation X is 0 rotation Z is 0 and the max value is, when rotation X is 55 rotation Z also 55.
What i want is when i decrease rotation X back to 0, rotation Z should stay at 55, and when i am going again to 55 rotation X then rotation Z should go to 110.
And this must go on rotation X back to 0 rotation Z staying at 110 then rX to 55 rZ to 165 etc.
Driven keys are mapped functions, which means the same input always produces the same output.
And I can’t think of anything that does what you want off the top of my head, so my guess is you’re going to have to write some code to do what you want. I would say this is a job for the
Thank you, i am trying to figure it out now
Driven keys also have input and output nodes, so you can drive them through remapValue nodes, or clamp, multiplyDivide, or whatever.
You could have the output of your rotateX input to a remapValue node that goes from 55 to 55. And then a 2nd remapValue node whose input is 0 to 55 (rotateX input again) and the output is 55 to 110, which would drive the outputMax of the first remapValue node.
I don’t imagine I described that very well with words. But hopefully that gives some ideas.
(I haven’t tested this.)
0-55 is your driving attribute. The two rectangles would be remapValue nodes. The output would go to your rotateZ.
(Also, re-reading your original post, I think I am misunderstanding. I think you want to do some looping stuff, where the values keep advancing on one thing, like a ratchet moving forward?)
Maybe you could just make a driver that is always moving forward, but X goes forward and then backwards. And Z pauses while X goes backwards, and then Z continues to go forward.
But your actual driving attribute would just be a straight linear value. (But again, I am not certain I understood correctly.)
Hi thank you for your responce.
Yes exacytly like the rachet mechanism.
What i am trying to achieve is a realistic function of a hammer and a cylinder.
Right now what i have and it is working, is one attr that goes from 0-336
6 bullets, for each bullet the animator must pull the hammer from 0-55 and at 56 the hammer drops.
From 0-55 there are 4 stages 4 clicks(0-10),(11-25),(26-35),(36-55).
I manage to repeat all these stages and add one more frame each time for the shooting.
So the cylinder rotates full time at 336.
But, i would like also to break it in two attributes one for the hammer that goes back and forth and one for the trigger, just like the real thing.
Thats why i want the cylinder to add rotations the second time you will move the hammer again from 0-55.
But from 55-0 the cylinder must be still.
Still no luck.
I am trying to write a function that will be in a scriptNode so will run each time the animator put values on the rotateX of the hammer. From 0—>55 is working, but i am stuck at the point where i have to lower the values from 55–>0.
>import maya.cmds as mc def hammer_C(): RX = mc.getAttr('hammer.rotateX') RZ = mc.getAttr('cylider.rotateZ') if RX > 0: mc.setAttr('cylider.rotateZ', -RX ) elif RX < 55: mc.setAttr('cylider.rotateZ', RZ ) else: print 'TEST'
So basically i would like to know if there is a way in Python to say: As the value_A goes from 0 to 55 do that and as the value_A goes from 55 to 0 do something else.
Another attempt with while but still not the desire effect…
import maya.cmds as mc RX = mc.getAttr('hammer.rotateX') counter = 55 while counter > 0: if counter == 0: RZ = mc.getAttr('cylider.rotateZ') mc.setAttr('cylider.rotateZ', RZ) break print (counter) counter -=1 else: mc.setAttr('cylider.rotateZ', -RX )
Honestly, I think you are going down an unnecessary rabbit hole by trying to automate or script this.
Why not just use a single driving attribute like in my last image (as the driver progress into the 2nd stage, X goes backwards and Z waits), or better yet, just simply separate the controls and let the animators control it?
In other words, what result will you accomplish by automating this that wouldn’t be achieved by simply animating it?
With an extra transform offset on the controls, it will be trivial to add shaking ease-in-ease-out effects as well.
I once saw a rigging artist try to connect the steering wheel rotation to the turning of the wheels of a car. It made logical sense. But that kind of strict dependency makes it harder for animators to work. Not easier. You might have a valid reason to automate this, but I suspect it is the same situation.
You are absolutely right.
I had allready the single driving attribute you said and this serves the fanning of the revolver.
I just want to make this so the animator animates just the hammer and the trigger.
With the previous attribute it will be hard for him to find the correct position when the hammer drops.
He will have to serach from 0-336 and find the 6 stages of shooting.
Also when he will load the gun he might need to rest the hammer without shooting.
Just like the real thing.
I have rig the internals mechanisms also, because i want later to do an explode version and to show how it works.
I know you are right about the rabbit hole, but i am also curious to see if this can be done as an rnd also for future prjs.