Simple question: I need a line between two previously made objects 'empty' so that it remains attached to these vertices: the line itself can't be moved, but moving the vertices modifies the line. Thanks!!
2 Answers
You can use vertex hooks, example: draw a line mesh (2 vertices).
Then in edit mode, select one vertex, press CTRL+H and select "hook to new object". Here an example for a cube mesh, easier to visualize: it works anyway.
A new "empty" will be created where the vertex is, and the vertex is "hooked" to it (meanwhile a "hook" modifier has been created, for your line mesh, with proper relations to empty object).
Do the same with the other vertex. Now you have the line mesh and two empties. Wherever you move the empties, their respective hooked vertex will follow.
You can also hook to existing objects (empties or others) or bones, choosing other options after CTRL+H. You may need to select them first.
In this case you'll probably have to move the control points to the respective empties origin while in edit mode to set their position:
-
$\begingroup$ Thanks!! But I have problems doing that with existing empty objects. In Object Mode, I select first the empty, then the line, then tab to Edit Mode... but CTRL+H gives three options (hook to new object, hook to selected object and hook to selected object bone), but no one works. How should I do it? $\endgroup$ May 29, 2016 at 11:07
-
$\begingroup$ you can check the hook in your objects modifers to fix it (the target object has to be the empty) or do the entire hook manually there. $\endgroup$– BithurMay 29, 2016 at 11:18
-
$\begingroup$ @m.ardito How can you snap to the empty? I see in your gif a little orange circle appearing, but I can't get it $\endgroup$ May 29, 2016 at 11:30
-
1$\begingroup$ @jekyll-friend: if you select the empty, then the mesh, go in edit mode and select the vertex, press CTRL+H and select "hook to selected object", it will be hooked immediately, since the empty is the only other selected object. If the empty is not in the same vertex position, though, visually it seems that nothing happens, but it's hooked. Try to move the empty, the vertex will follow. To make the vertex reach a distant empty, you can use the mesh snap tools,as in the Carlo's gif. The circle you see there is a visual snap confirm of those tools. $\endgroup$– m.arditoMay 29, 2016 at 11:49
You may do it using Stretch To bone constraint.
Add a bone (Shift+A-->Armature-->Single Bone) between Empties.
With a bone selected in Pose Mode go to Bone Constraints header-->Add Bone Constraint-->Stretch To
Now being in Object Mode create a simple line consisted of two vertices (add a plane and delete two vertices). Place it exactly between Empties. Name it viz.
Select the bone again in Pose Mode, go to Bone header and type viz below Custom Shape in the Display panel. It'll change the bone appearance to the line you've created. Next go to Stretch To constraint settings and adjust the Rest Lenght value to make the line fit between Empties.
Lastly you may parent (Ctrl+P) the bone and second Empty to the first Empty to make them move together.