# Rotate around one point, with constrain on z-axis for other point, impossible?

In an animation, I would like to rotate an object, while at the same time constricting its movement on the y-axis, but I can't figure out how.

After fiddling around with start and end frame of the rotation, in relation to the start and end frame of the translation along the y-axis, I tried parenting the 'door' to a cylinder (see screen shot below), but I can't stop top of the 'door' (marked by a purple 'x') moving along the z-axis, when the cylinder rotates.

So, my question is:
How can I get the setup the desired motion?

Update
Screen capture of (faulty) animation
In the screen capture you can see the animation going wrong: the lower stud on the door should stay inside the curved rail. The curved rail is a a (quarted of a) circle.

• Does locking the Z axis in the properties panel not do anything? Nov 20, 2017 at 21:55
• @Brenticus, No, locking the Z-axis does nothing whatsoever Nov 26, 2017 at 15:42
• It can be proven that what you are trying to do is impossible. One can't have the tip and the origin move at the illustrated paths at the same time. Nov 26, 2017 at 16:18
• Are you trying to do something like the scond examople here: blender.stackexchange.com/questions/52681/… ?
– user1853
Nov 26, 2017 at 19:02
• @cegaton, I'v added a screen capture to help explain what I'm trying to achieve. Nov 26, 2017 at 19:42

There's actually a very quick way to do this. All you need is 3 bones with an IK constraint. Set the root of the first bone at the center of the cylinder in your diagram and the tip on the edge (where the lower stud would be). That way when the bone rotates the tip will follow the track. Now extrude a bone up to the top of the door (top stud). Finally extrude another bone horizontally (left in the case of your diagram) and clear the parent on it.

Then in pose mode, add an IK constraint to the second bone and select Armature in the Target box and the 3rd bone that we cleared the parent on in the Bone box. Now, when you move the 3rd bone (which will be the control bone) the other two bones will follow, the door will open, and the lower stud will always stay the same distance from the center of the track radius.

Optionally you can add a limit location constraint to the control bone (as I did in the gif below) to ensure that the control bone never moves where it shouldn't.

All you then have to do is parent the door to the second bone (the yellow one with the IK constraint) and everything should be good to go.

• Thanks for the answer! It looks elegant, I'll give it a try asap. Nov 27, 2017 at 20:46
• How do I find the coordinates for the Limit Location constraint? Nov 28, 2017 at 22:03
• Open the properties panel with N and look under the transform heading. In your image above you'll want the y axis value. Close the gate (should be the default position of the rig) and look at the y location value for the top bone. Use that as the maximum. Then open the gate, and as soon as the gate is fully open use that value as the minimum. In my case it was a max of 1 and a min of -1, but yours will probably vary. Nov 28, 2017 at 22:18
• Thanks! bones are a most useful addition to my list of things I need to learn : ) Nov 29, 2017 at 21:21

Some trigonometry should help:

Let the distance between the origin of the red rode and its tip be 1 (or anything), sin(a)=h, so a = arcsine(h) but h equal to the z position of the orange rod minus the position of the origin of the red rode, so we know the angle a, by using drivers or Animation Nodes to set a to the red rode as rotation, we get:

• Looks really promising, but (I'm a complete newbie) how do I access Animation Nodes? Nov 26, 2017 at 21:06
• @Jacco Animation Nodes is an addon, you have to download it, see: blender.stackexchange.com/questions/41928/… Nov 27, 2017 at 12:52