I would appreciate it very much if someone could point me in the right direction. I was trying to rebuild something like that.:
The problem I have right now is that I am not able to limit the movement of that blueish colored part in the gif. First I parented it to the golden colored part and tried to limit the rotation. That didn’t work. I placed an empty in the middle of the copper colored part and copied rotation values but ended up at the same point.
Well, it would be great if someone could help me out
.linearMotion.blend (495.3 KB)
Well Sir, I would do all this with a single Armature. Why, because it is a classic example of Inverse Kinematics for the piston, connecting rod and crank. The fly in the ointment is that the main crank, the white bits, are not normal to the crank rotation, they are at 45 degrees. So for here I would use two drivers to rotate the various parts according to the crank rotation. Here is a picture:
This means that you need to use scripted expressions. So, for my blend file to work you must check “Autorun Python Scripts” in user Prefs => File tab. Now to the drivers themselves; you want he blue object to rotate ± 45 degrees relative to the crank, so the driver for this is:
pi / 4 * sin(var)
Where var is the Y rotation of the crank bone in Local Space. All drivers work in Radians and there are 2 * pi radians in 360 degrees. so the link rotates pi / 4 (45 degrees) according to the Sine of the crank rotation.
The next driver rotates the hexagon topped bit (sort of brown colour) this needs to rotate back and forth by 45 degrees also, but along its local Z axis, so the driver is this:
(pi / 4 * cos(var)) - (pi / 4)
So, this one rotates the opposite mode to the first, so we use Cosine instead of Sine (Cosine is 0 when Sine is 1) and we subtract 45 degrees from its rest position, since it also is 45 degrees out of phase with the first one.
Then you just run the animation, remember when you stop an animation with drivers, you need to move it one frame to reset itself, since drivers effectively work one frame behind the animation (just accept that for now).
A render of the file, don’t look too closely at the modelling, it is just thrown together to show the important part of this project, which is the Armature:
Here is the Blend file: crank-thing.blend (643.8 KB)
Just press Play (ALT+A) and don’t forget to reset it by clicking the Start Position Icon twice.
This is awesome, what a cool mechanism.
I’m not the OP but thanks for the math behind it, @clockmender.
As a challenge I tried to do it with constraints only:
constraintsOnly.blend (436.1 KB)
(Spin the shaft object on the global X axis for the thing to work.)
You’re very welcome! Nice solution you posted, my only comment is that the action is then divided between various objects, rather than all being in one object (the armature).
Thank you very much for your help. The reason why I was trying to solve it with constraints is that I thought it would be easier and faster. After following your explanation I am not so sure about it anymore. With a little background in CAD-programs constraints seemed to be the proper tool for this. ( In these programs you define relationships between parts in a step-by-step procedure.)
Thank you very much for your work and help. Your file helped a lot.
I hear that, I have many years experience with CAD dating back to 1980, but the CAD programmes didn’t have Armatures, Blender does and armatures are there specifically to animate objects, nothing else. So that is why I use them and only them, to animate objects, that and the fact that all actions are in one object so Blender runs far more efficiently. Object Constraints can be useful to fix objects in a static render, but IMHO, they are nowhere near as good as armatures for animations.
Any mechanism that relies on a rotating object and a sliding one is far more efficiently handled by an IK chain in an Armature, rather than multiple constraints on multiple objects. Blender is not a CAD programme, you, like I had to, have to get the CAD procedures out of your head and get into Blender as an animation tool first and foremost. Your modelling also has to alter from CAD principles and get into Blender modelling techniques. It’s a hard learning curve, but very rewarding once you get there.
If you want to get into procedural animation you need to start looking at Animation Nodes, true procedural animation and so powerful. I am now writing my own animation nodes to augment the brilliant work of the original development team, just look at my website under the relevant pages. I don’t want this to sound like criticism, it’s not, I just want you to get the best out of Blender.
Keep up the good work!
You can use the exact same constraints of that ‘constraintsOnly.blend’ scene with armature bones, and also replace the empties with parentless / loose bones.
This will let you follow clock’s recommendation of using an armature as the controller of animated objects in your scene. You don’t have to use vertex weights and modifiers to have the armature control different individual objects, you can parent those objects to the appropriate bones.
Hey, hi all…
I looked at the original file posted, didn’t look at any other files. I question the design…
I just don’t think that is an efficient design, but whatever. I do get it, that sometimes we play with things that don’t exist. Spaceships that defy gravity, walking mechs, etc…
If it’s a prop, I get it… other than that, why? Just doesn’t make sense.
If clockmender’s example works, which I know it does without looking at it, then go with it. He is spot on when it comes to animating mechanical objects!
PM me clockmender…
Bone Parenting separate objects is a mech animators’s best friend! If I can say that without it being misconstrued…
Model each part as a separate mesh, then select each part in turn, SHIFT+Select the required bone, then key CTRL+P => “Bone”. This parents the selected object to the selected bone. No Armature Modifiers, no Vertex Groups, no Weight Painting, no hassle!
Thanks for pointing that out @RNavega, I should have said this earlier, but that is how I built my uploaded file.
Bones need not be parented, or connected to other bones. Bones need not be connected if they are parented, its a myth that if you have a bone a long way from another, which must move with it, that the second bone must extend to the first. Unlike real life, large bones often present problems rather than solutions…
Here’s a simple example, one is easily usable in an animation, one is more difficult, both do the same job:
@revolt_randy thanks for the kind words Sir!, I will PM later today after I have done all the chores…
EDIT: I agree with you that we make things here that could not exist, for example, one idiot here has this robot with valve electronics and a top hat that he keeps using in his projects.
The design of course is questionable, and in real life inefficient and unpractical. But then again it is somehow something beautiful to look at. I like those quirky mechanics.
There is something I forgot to mention. You could have just said “forget constraints, use armatures!”. Instead you provided a file that included everything from a beautiful model, materials and an armature. Thank you very much again for your work and the time you put into it. I learned quit a lot by analyzing your blender file.
You’re welcome, that was why I made & posted it…
I agree, that’s why I commented. I could totally see this as a steampunk sort of machine…
Your crazy out of the box machine did catch my attention, congrats on a good design…
And to the riggers in this thread. I would have done it with bones and bone constraints, or at least tried it that way…