Armature rig - angled shock absorbers

This is a very simple setup for undercarriage. The green is the wheel. The dark bit is a slider along the blue rod. The grey cylinder extends inside the red cylinder - like hydraulics or a telescope. The yellow bits are hinges - the wheel spins on the end of the blue rod, the blue rod rotates at the top, the red cylinder rotates at the top, and the grey rod can rotate around the dark slider.

I’m trying to make it so that the system will compress properly to a vertical input - I was thinking a free-floating bone with a floor constraint. The bone would also stick to the floor so I can use IPO drivers to rotate the wheels.

I have mainly two problems:

How can I rotate the blue rod so that its end matches the vertical movement of the floored-bone?

Also, how can I make sure that the slider stays on the blue rod, but still attached to the grey rod which rotates about the red rod’s hinge?

Thanks for any help.

Actually, I realized that setup is mechanically unsound. The slider can move along the blue rod even if the hydraulics don’t change size.

Here’s a more clear setup. I also changed a couple colours to be more clear.

I moved the hydraulics under the blue rod. The dark red cylinder is fixed to the blue rod at the top by a black connector. The bright red rod is fixed to the dark slider also by a black connector.
The purple rod is where the hydraulic used to be. It is connected to the slider via a hinge.
I also changed the colours of two hinges to be white - these two hinges are fixed points (to the airframe or whatever.)

My questions are still the same: How do I make the blue rod rotate such that its tip has the same vertical position as a target? And how do I constrain the dark slider so that it is always along the blue rod?

I figured out the answer to the first problem. I’m double-posting so other people could possibly see the solution.

To rotate the bar so that its end corresponds with some vertical position, I just have to use a curved IPO driver. I originally dismissed an IPO driver because the relationship between vertacal height and rotation is not linear - but IPO drivers need not be linear. :smiley: Now I just need to do the math to see what the shape of the IPO curve needs to be - I’m thinking it will be a sine curve.

I still don’t know how to restrict the slider, though.

Edit: Forget everything I said about IPO drivers. Turns out you can’t have an IPO drive from a constraint-based location change. I don’t know how to get either parts 1 or 2.

This looks like a job for track-to constraints and judicious parenting. Here’s an old tutorial on rigging a mechanical that may be helpful to you. Some of the details have changed, but the principles are still sound.

Hey! I’ve been looking for that tutorial! Someone should upload that to the wiki! That article is very helpful and it taught me how to make hydraulics.
It doesn’t help me with these two problems, though.

Hey! I got the slider to work! Turns out IK was the solution. The bone that controlled the slider position needs to have limits on rotation, but can be allowed to stretch. This was attached to a short bone that the slider was parented to. This stretched off to another bone which was IK’ed towards the top hinge.

There’s the file.

Maybe getting it to rotate in response to a vertical input needs IK solvers as well…

Edit: Okay, I got the landing to work, sort of.
using IK works, but the problem is that this solution’s rather laggy. Try moving around the parent empty - the gear lags behind a little bit. Does anyone know how to make it more responsive? Does it have to do with the iterative method of IK?