Copy rotation with axis in different planes.

Hi ! I’m making a machine with Blender 2.32.

Is it possible , using the constraint “copy rotation” or an other way,
to make a cone-shaped gearwheel rotate around its z axis (for example)
according to the precise rotation of an other cone-shaped gearwheel (around its own axis), if their two rotation axis are in different plane (90° angle in my animation)?
Note : The first gearwheel is animated by an Ipo curve, but I do not want
to use an other one for the second gearwheel, because it is not precise enough for the second one.

Thank you for some help !

Philippe.

You could just copy/paste the IPO curve from one object’s parameter to the appropriate channel using the arrow icons in the IPO Window header.

(If your IPO window is too narrow, they may not be visible and you would then have to Middle Mouse Button drag them so that you can view them).

Also note that there must be an existing curve in order to paste the curve.

ie. select the rotation axis you want to paste to and Ctrl_Left Mouse Button click anywhere in the IPO Window prior to pasting.

Thanks for reply. May be I didn’t explain well my problem. Even using copy/paste Ipo, I do not want to use Ipo curve. I want to enslave the second (and others) gearwheels, when rotation the first one, in order to simplify my animation.

Other suggestions wellcome. :o)

I don’t think this can be done with blender’s built-in constraints alone, but you can write your own constraints in python.

Give your 2 objects names. I called the gear with the IPO “LeadGear” and the gear to be driven “TailGear” - but you can call them whatever you’d like.
You can change the name in editbuttons (f9), it’s the box labelled OB in the top left.

Bring up a script window (Shift+F11) and Add New. Give it some useful name like “GearsConstraint” or something.

Type in something like:

import Blender
driver = Blender.Object.Get("LeadGear")
drivee = Blender.Object.Get("TailGear")
drivee.RotY = driver.RotZ * 0.5
Blender.Redraw()

I used the 0.5 because my driver gear was half the size of my drivee gear. You can put any number here to change the gear ratio. If you find that the gears rotate the wrong way, just make this negative.

Then you bring up the script buttons (between logic buttons and material buttons), click on “New” in the script links, set it to FrameChanged and type in the name of the script. This will make it run the script every time the frame changes - even while rendering.

If you have several gears, you can either have several scripts and several script links, or you can put several in one script, like:

import Blender

driver = Blender.Object.Get("LeadGear")
drivee = Blender.Object.Get("MidGear")
drivee.RotY = driver.RotZ * 0.5

driver = Blender.Object.Get("MidGear")
drivee = Blender.Object.Get("TailGear")
drivee.RotX = driver.RotY * -3

Blender.Redraw()

To avoid a nasty problem with Euler coordinates called “Gimbol Lock”, use Ctrl+Alt+A (Apply size+rot) to reset the local axes to match the global axes. Then change the RotX/Y/Z to whatever axes the gears rotate on.

To see what gimbol lock is, add an empty, then set it’s rotation x/y/z in the N panel to 0, 90, 0 to make it sideways. Then figure out which value to change to make it rotate around its Z axis. The answer is that there isn’t one, but if you set the rotation to 90, 90, 90 then you get the same rotation, but changing RotY rotates it around the local Z axis. But now the Y axis is “locked”.

Rather than go through all that to try to figure out which axis to use, it’s easier to just Ctrl+Shift+A, then it’s all fine (assuming you’re rotation is around a real axis… if it’s not, I’d make it so it is, than parent it to an empty and move the empty into position).

I only bring it up because I hit that exact problem when setting up a test scene for the script above. :frowning:

HTH

Thank You for your complete explanation. It’is not yet very luminous for me at the moment because I’m only using Blender for 4 monthes and I never learnt Python code, but I will do ! I think the solution is in your message, and i’ll study it very carefully ! Thanks a lot !

Philippe

Hi Phlip!

I have studied the script lines you gently sent to me, and Now it is luminous ! my problem is solved ! thank you for putting me on the right way ! My machine works ! Yeah !

Philippe.