1
$\begingroup$

I have an object, a tilting board inside a frame, with three pivot points: two of which are fixed, and one of which slides along a member (actually, the member slides along the pivot).

How would I animate the board tilting at various angles about pivot (#1), while keeping the sliding member constrained by the intersecting rod (#3) and the pivot (#2)?

enter image description here

$\endgroup$
  • 1
    $\begingroup$ could you please show 2 positions so that we understand correctly the mechanism? $\endgroup$ – moonboots Aug 8 at 7:51
  • $\begingroup$ If you share the relevant part of your file on blend-exchange.giantcowfilms.com I'll have a look, and line things up. $\endgroup$ – Robin Betts Aug 8 at 20:01
3
$\begingroup$

You can use constraints, here...

enter image description here

Construction

  • All objects constructed with local orientation aligned to world
  • Flap and Frame origins both at world 0
  • Slider origin at its hinge point
  • A target Empty at the center of the constraining rail

Parenting

  • Flap and Empty CtrlP parented to frame
  • Slider parented to Flap

Constraints

enter image description here

  • Slider given locked track constraint targeted on the Empty ( In this example, positive X is to our left)

enter image description here

  • Flap's Rotation limited to a range in Y so as not to run off the end of the slider

enter image description here

Now you can simply key the rotation and location of the frame, (the rest will follow), and key the Y rotation of your flap.The slider will behave appropriately.

Here's the implementation on your file, (revised, I've made a correction to center the hinge of the flap to the flap's rotation)

And a 2.79 version:

On the question of how parenting interacts with constraints, I have to reverse-engineer.. I wouldn't know where to look in the code in a reasonable time, so what follows is an informed guess, which I would be happy to have corrected.

Further to @sambler's answer here, at a lower level, to perform a transformation T of a child C in a parent P's space, you would:

  1. Give C the inverse transformation of P (as it were, bringing everything into World space), followed by...
  2. ... executing T on C, followed by...
  3. ... giving C the transform of P again, to put it back in the frame it came from.

These transformations would be multiplied together in the right order, as matrices, to yield a single transformation matrix by which you can multiply the coordinates of all the vertices of C.

Naively, I can imagine, if 'Local' is selected, constraints being checked at step 2, with any targets undergoing step 1 as well as C, so they are compared in P's space. The effect is that constraints are applied after parenting.

In this case, the slider (its origin) does rotate with its parent. Its local rotation (at step 2) is constrained.

$\endgroup$
  • $\begingroup$ Many thanks. That's exactly what I'm trying to achieve! I tried your suggestions, but the slider either rotates along with the flap, or doesn't move. A few questions: 1. does it matter if the parenting is with "keep transform"? (I tried both ways, but neither worked). 2. My X and Y axes are reversed from yours. For the constraint, I used "to:" -Y and tried "lock:" X and "lock:" Y, but neither worked. Also, is the Empty part of the frame, or added as a separate object? (I assume a separate object). Oops, I didn't key these, just moved them in object mode. I'll try again . . . $\endgroup$ – Crowdpleasr Aug 8 at 19:16
  • 2
    $\begingroup$ Hi. Don't despair. It will only be a matter of aligning axes. Ctrl-Space make the 'Move' gizmo visible in 'Local' Transform orientation to see the local orientations of your objects, which are the ones that matter. Test each step as you go. Before the slider is constrained, but after parenting, it should rotate with the flap. 1. In this case, don't 'keep transform', if the objects are aligned with each other as described. 2. If XY are flipped, the 'to' will be Y or -Y, and the 'lock' will be X. The Empty has to be separate, and parented to the frame. I would share my file but it's 2.8.. $\endgroup$ – Robin Betts Aug 8 at 19:59
  • $\begingroup$ Many thanks in advance and much appreciated (and sorry for late reply as I have been traveling). As per the attached, it's almost working, but the slider "breaks" through the constraining rod. Thank you so much for taking a look, and letting me know what I need to adjust! <img src="https://blend-exchange.giantcowfilms.com/embedImage.png?bid=6366" /> $\endgroup$ – Crowdpleasr Aug 13 at 5:35
  • 1
    $\begingroup$ @Crowdpleasr ..Here you go ..(see edit).. You were pretty much there . I corrected the position of the slider target, and put limits on the rotation of the flap (2nd constraint in the answer). I've also: 1. named the parts (If you're in larger projects, you'll never regret being obssessive about that) and 2. Locked off unwanted transforms (in the 3D View > Properties panel > Item tab > Transforms) so as to prevent the rig from accidentally being pulled apart. 3. remodeled the rod to get rid of internal faces. $\endgroup$ – Robin Betts Aug 13 at 8:41
  • $\begingroup$ Thank you so much!! One last question before I close this out . . . I'm still trying to understand how parenting the slider to the flap makes the slider rotate in the "opposite" direction to the flap. I thought that parenting meant that if the parent rotates n-degrees, the child will also rotate in the same direction. Adding the constraint makes the slider rotate in the opposite direction to the flap. I'm just trying to understand how the constraint interacts with the parenting to produce the desired behavior. If convenient, can you pls break down what's happening at a low level? Thank you! $\endgroup$ – Crowdpleasr Aug 13 at 23:20

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.