0
$\begingroup$

I am trying to make an animated lock tumbler and the key pins should move along the contour of the key. My goal is to move the pins up when the key passes underneath them by using some sort of snap to surface setting and constraining the motion of the pin to only the Z-axis. I'd also like to set a minimum for the Z-axis so once they get to a certain minimum height they won't drop any lower (to simulate the pins resting at the bottom of the cylinder. I have been doing a lot of searching for snap to surface and motion along a path but I'm not sure that I can use that during an animation. Does anyone have advice on how to approach this? I'm attaching an image of the key with the pins snapped to the part of the key I'd like it to track.

enter image description here

$\endgroup$
1
  • $\begingroup$ Read about drivers $\endgroup$ – Lukasz-40sth Aug 11 '20 at 6:45
3
$\begingroup$

Here's one way, it's not perfect, because of the limitations of the Clamp To constraint.

  1. Duplicate a central loop of your key, and Header > Object Menu > convert it to a curve. Extend the curve to tip-base level on both sides.
  2. Place the origins of your tumbler-pins at their tips.
  3. Assign them each a Clamp To constraint, targeted on the curve.

enter image description here

(It's sensible to get this constraint working on one tumbler to begin with, after settling the curve, making sure its scale is applied, etc.)

Because of the way the constraint interpolates the curve, there's some drift in the horizontal direction. You can eliminate this with another constraint on the tumbler: Limit Location to fix it in all axes apart from up-and-down.

enter image description here

If the whole lot is to be parented to other parts for rigging, it might be better to do that first.

enter image description here

the curve remains editable to make small adjustments to the pin positions, if necessary. Excuse the grotty .gif

$\endgroup$
7
  • 1
    $\begingroup$ Thanks! I gave it a try, and I got the pins moving but I am getting some drift along the Y axis even with limit location Y set to 0.0-0.0 local on the pin mesh. You don't seem to be having the same issue.. trying to figure out the difference. Including a link to the gif of my animation. link $\endgroup$ – mord Aug 11 '20 at 20:50
  • 1
    $\begingroup$ Also adding a grab of the object constraints on the pin mesh. link $\endgroup$ – mord Aug 11 '20 at 20:53
  • $\begingroup$ I did convert it to a poly curve which simplified it and it didn't line up so well with the key, but it did reduce the drift significantly. Then when I remapped it to the key contour the drift came back. Do you happen to know where the limitations are documented so I can understand them better? Hoping it will let me work around them a bit. Thanks again for all of the info, accepted this as the best answer as it gets me 98% there. $\endgroup$ – mord Aug 11 '20 at 21:10
  • $\begingroup$ @mord Aaah ! the limit location should come after the clamp.. be superimposed on it. Hold back, You never know, someone might come up with a better way. $\endgroup$ – Robin Betts Aug 11 '20 at 21:11
  • $\begingroup$ @mord The explanation of how the constraint works is in the manual page linked in the answer. $\endgroup$ – Robin Betts Aug 11 '20 at 21:19

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.