How to make limited stretch on an IK chain?

rigging

(insolitus) #1

Hi all!
I’m trying to rig a mechanical leg where one of the links in the IK chain is of a piston type. Ideally I would like to have a limit on how long the piston can be since it’s physically impossible for it to stretch more than a certain amount. Like the IK angle limits but for stretch. Is there any known good workaround?

I have found the following resource that touch on the subject:


Problem: The location limit on the IK target dosen’t work when it’s dragged in any other direction than only Y as far as understand the rig.


Problem: The piston part is actually not part of the IK chain so animating with this would be more hassle than if the piston is part of the IK chain.

My only idea right now is to create some kind of rig where the actual mechanics of the rig is taken care of with bones that are connected as a scissors lift (so I can use angle constraints) and then just add on the piston somehow. Is this a reasonable workaround or is there any other way with scripting/drivers or similar?

Thanks in advance for any advice! :smiley:


(Clockmender) #2

Just put a Limit Distance constraint on the IK target with a bone at the centre of rotation of the piston/cylinder as here:

The amount of stretch does not limit the stretch it is an index of stretchability, so if you have two bones in the IK chain that can stretch and you want one to stretch twice as mush as the other you would set one to stretch = 1 and the other to stretch = 0.5.

Not the way to do this…

Why not? The chain should consist of a Stroke Bone, a Cylinder bone parented to the Stoke bone at its head, a Piston bone parented to the Stoke bone at its tail, nether Cylinder or Piston inherit scale. Move the IK target, the Stroke expands and the Piston and Cylinder follow it but don’t scale, so the meshes parented to these bones don’t scale either. Picture:

Nah, don’t do that…

Let me know if you don’t understand this and I will make you a little blend file. :smiley:

Cheers, Clock. :beers:

PS. Nice video from my good friend, who has only ever disagreed with me once and that was over four years ago :rofl:, @DanPro :sunglasses:


(insolitus) #3

Thanks Clock! :smiley:
I’ll give your example a go and get back with the results! I understand your example, and I agree that limit distance seems like the way to go. Not sure if I understand how to put it in the complete rig, but I’ll give it a go! :+1:

Ah! I didn’t know the relation worked like that, good to know!

Yes, his videos together with Humane Rigging is gold!

Thanks again, and cheers!:beers:


(insolitus) #4

Ok, so since I can’t get this problem out of my head I made a small mechanical model, including the piston and tried to rig it.
It looks like this:


I did put a Limit Distance Constraint on the IK Target, measuring from the cylinder bone as you showed, but I get dependency errors since the IK chain also affects where the cylinder bone is located. The IK chain in this case has a chain length of three so all bones to the up to the pin is affected.

Could I divide this into two IK chains to work around this? Or how can I otherwise do?


(insolitus) #5

Some time have passed and the only way I got this working ok-ish was to fake the stretch constraint with angle constraints. I’m aware that this is not a general solution but I think it will work in my case. Made a short clip if anyone is interested in how it behaves, see below. There are some issues when the IK chain is totally straighten as you can see, but it can probably be ignored in most cases. Bone stiffness is tuned to get a nice feeling.

Questions or comments? :slight_smile:

Cheers! :beers:


(ajcdfin) #6

Hey, Here is a link to a slightly modified version - study the ‘outliner’ so you can see how I did it, have any questions - post back. Sorry running short on time right now.

https://drive.google.com/file/d/1A7vEhBVGBRfygbOY4-mKWC4d7ClCnpm4/view?usp=sharing


(Clockmender) #7

Sorry guys for not replying, I have been mega-busy with other things, I hope my good friend @ajcdfin came up with the goods as per usual.

Cheers, Clock. :beers:


(insolitus) #8

Thanks @ajcdfin for the solution :+1: Unfortunately, as far as I can see it has the same issue as the rig in the post I linked to in the first post, i.e. the stretching is not controlled by the IK Target. Or is there some driver behind the scene that I don’t get or can see?


(insolitus) #9

No problems @clockmender :slight_smile:
If you have time, please check the video I posted and see if you can find any problematic issues with the rig. I did as you recommended not to do, but so far it seems like the only solution :worried:


(ajcdfin) #10

Hey, The file I posted may be like the video in your first post, the stretching is not controlled by the IK Target and there are no drivers added.
You said " I’m trying to rig a mechanical leg where one of the links in the IK chain is of a piston type". 1) The ‘Rams Yoke’ (the part that moves in / out of the cylinder) is going to have something attached to it, true ? Lets assume that it is a ‘foot’. That part (mesh) is not going to be ‘parented’ / ‘constrained’ to your ‘IK Target’, you need a ‘foot bone’ which is the child of the ‘Rams Yoke’ bone.
2) To me your set-up mimics a spider leg but with a hydraulic cylinder as one part, each one by them selves is fairly easy rig, but combing those two together, that is a bit tricky. First you want to be able to move / control the leg easily, which is what ‘IK’ does. Second you need to move / control the cylinder which at some point it will need to affect the rest of the leg. Example = (assuming a ‘foot’ is attached to the ‘yoke’) when you put the ‘foot’ on the ground and extend the ‘ram’ you don’t want it to go into the ground, you want the rest of the leg to move away from the foot.
Ultimately its going to need a multi - bone set-up ((rigs with in a Rig) to make animating it easier. If I assumed to much about your set-up then just ignore me rambling on here :hushed: :grin:


(insolitus) #11

Hehe you’re definitely not rambling more than I do at least! :smile:
You are quite right with your assumptions. I’ll see if I can get a proper view of the actual leg soon, just need to get some more modelling done first. That will probably make it easier to understand.
Do you have an example or link to the type of rig you speak of in your second part. It sounds like exactly what I’d like but I don’t understand how I’d get there :thinking:


(insolitus) #12

Hello again! As promised here’s some pictures of the actual leg. The model will become a Space Marine Dreadnought (WH 40K universe) so the concept isn’t mine.


I hope these three pictures gives an understanding for the mechanical buildup of the leg. The four pistons on the outer ring of the foot are hydraulic pistons to control the foot angle and the middle will be a damper. I don’t think I need to animate the damper more than making it part of the IK system as I’ve talked about before (even though I said piston), but the foot angle needs some proper control. If the damper is considered critically damped I believe it should behave roughly like my piston in the IK chain in my video. Other body movement should help with the feeling of weight too.

I’m aware that the mechanical sanity of this construction isn’t really there, but it looks cool so I’ll try to stay as close as possible to the concept. I haven’t tried to implement my last try with the damper in the IK chain yet but I’ll get back to this thread when I have. The rest of the rigging feels quite straight forward.

I feel like I’m rambling right now so ask away if there’s any questions or comments! :beers:


Unable to create linear bone slip, slid or stretch on Inverse Kinematics
(ajcdfin) #13

Hummm…That is a very interesting model, I would have to see the actual rig as you have it to be of any help. Thanx


(ajcdfin) #14

Hey, I had a chance to work on this a bit, maybe this will help address some concerns, there is a text file included. Post back if you have any questions, thanx

EDITED 1/11/18 ;

EDITED; 1/15/18 - removed link


(insolitus) #15

Hey man, sorry for the late reply! I totally missed that you had written, thanks!
I downloaded your file but I can’t understand how to use it properly. Probably because my lack of knowledge on drivers :sweat_smile: I opened in trusted mode so I can see the driver, and if I understand correctly there is a scale value I need to change to activate the driver. Is that correct? But where and how?
Thanks again for taking your time!


(ajcdfin) #16

Hey, the ‘controls’ are ‘custom properties’ assigned to the ‘foot rotation’ bone, you have access to them in the properties panel (N key) they are under ‘custom properties’, there are 3 controls . Read the text file I included for operation. I didn’t have time to make ‘custom bone shapes’ to control that stuff so thats why I placed them on the ‘foot rotation’ bone.


(insolitus) #17

Ahh now I get it! Thanks! :+1:
It’s a really nice and clean solution. A good idea with the “parallel” arm rigs, reminds of FK/IK switching. I will have to do some test animation to see what rig I end up with, it might very well be that your rig example here ends up easier to animate than my try with faking the IK stretch.
Once again, thank you for all help. Much appreciated! :pray:


(ajcdfin) #18

Your welcome


(obsurveyor) #19

Why was the link removed? I was following this for a solution but I guess I missed it?


(ajcdfin) #20

Sorry, its on my Gdrive, do you want the file link ?