2
$\begingroup$

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.

enter image description here


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.

$\endgroup$
  • 1
    $\begingroup$ Does locking the Z axis in the properties panel not do anything? $\endgroup$ – Brenticus Nov 20 '17 at 21:55
  • $\begingroup$ @Brenticus, No, locking the Z-axis does nothing whatsoever $\endgroup$ – Jacco Nov 26 '17 at 15:42
  • $\begingroup$ 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. $\endgroup$ – Omar Emara Nov 26 '17 at 16:18
  • $\begingroup$ Are you trying to do something like the scond examople here: blender.stackexchange.com/questions/52681/… ? $\endgroup$ – cegaton Nov 26 '17 at 19:02
  • $\begingroup$ @cegaton, I'v added a screen capture to help explain what I'm trying to achieve. $\endgroup$ – Jacco Nov 26 '17 at 19:42
7
+50
$\begingroup$

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.

enter image description here

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.

enter image description here

$\endgroup$
  • $\begingroup$ Thanks for the answer! It looks elegant, I'll give it a try asap. $\endgroup$ – Jacco Nov 27 '17 at 20:46
  • $\begingroup$ How do I find the coordinates for the Limit Location constraint? $\endgroup$ – Jacco Nov 28 '17 at 22:03
  • $\begingroup$ 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. $\endgroup$ – Brenticus Nov 28 '17 at 22:18
  • $\begingroup$ Thanks! bones are a most useful addition to my list of things I need to learn : ) $\endgroup$ – Jacco Nov 29 '17 at 21:21
3
$\begingroup$

Some trigonometry should help:

Illustration

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:

Node Tree

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.