4
$\begingroup$

Is it possible to attach the endpoints of a curve to two spheres, so that the endpoints would always move with the spheres even when moving the spheres independently of each other? Optimally it should also stretch and compress as the spheres move further apart and closer to each other. I'm doing animations of chemical reactions where I'm depicting the bonds between atoms with a curve which should stay attached to the animated atoms and I'd rather not calculate the transformations for the bonds separately.

$\endgroup$
1
  • $\begingroup$ Thanks a million--that's perfect!! How would I do that in python? $\endgroup$
    – Melodius
    Jun 25 '14 at 12:53
3
$\begingroup$

This is a great case for hooks.

Position your two spheres where you want. Then add the curve between then with the two ends where you want them to touch on the spheres.

In object mode select one of the spheres then select the curve; hit Tab to go in to edit mode. In the curve's edit mode select the end point of the curve on the same end as the selected sphere, then press ctrl H. Choose hook to selected object.
Repeat for the other end of the curve on the other sphere.

$\endgroup$
3
$\begingroup$

Use hooks to attach each end of the curve to a sphere. You will most likely want to set the curve handles to vector so the curve stays straight between the two points.

I would then add a driver to the curve's bevel depth to have it change size based on the distance between the two spheres.

enter image description here

enter image description here

enter image description here

$\endgroup$
2
  • $\begingroup$ This is perfect! Any idea how to do this in python? $\endgroup$
    – Melodius
    Jun 25 '14 at 14:38
  • 1
    $\begingroup$ One modification you could do since that scripted expression is a simple linear expression, you could replace it: Add Modifier to the driver (using the normally-hidden N panel) of a Generator with poly order 1, then set the coefficients. There is a python example in the addDrivers() method at web.purplefrog.com/~thoth/blender/python-cookbook/… $\endgroup$
    – Mutant Bob
    Jun 25 '14 at 20:36
3
$\begingroup$

Using hooks is a good idea. I'll add that the laplacian deform modifier works well with hooks for creating deformation effects that resemble natural tug. This short video shows the effect of the modifier and how to apply it using hooks. https://www.youtube.com/watch?v=VgiekNOK0Vw I created a simple example to demonstrate how this could be useful for this particular problem. https://www.dropbox.com/s/9dpgvb9ht0bh9vj/laplacian_deform_test.blend

$\endgroup$
1
  • $\begingroup$ Your answer is being flagged as low quality due to it's length. Could you add a bit more detail and maybe some examples? $\endgroup$
    – gandalf3
    Jul 5 '14 at 21:37

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.