2
$\begingroup$

I have the following: enter image description here

It contains two cube-like shapes, two sockets and a wire running between them (the curved one). The wire uses an array modifier and follows a nurbsPath. This is extremely difficult to adjust and I doubt it's the optimal way of doing it. I would like to accomplish:

  1. Have the wire connected to both sockets, so that moving any of them will automatically move and curve the wire.

2 Be able to rig and animate the curve between the cubes (the cylinder between them), and have the wire curve organically adapt.

3 If possible, have gravity and collision physics on the wire.

Is this possible? I appreciate all the help I can get!

| improve this question | | | | |
$\endgroup$
  • $\begingroup$ blender.stackexchange.com/questions/121357/… $\endgroup$ – Duarte Farrajota Ramos Sep 3 '19 at 10:54
  • $\begingroup$ @Duarte But this wouldn't work with the wire pointing upwards at the connected part like in the image, right? $\endgroup$ – Leander Sep 3 '19 at 10:56
  • $\begingroup$ @qtjCH5pLao6 Do you want to rig the wire with controler or have it simulate? I'm nt sure how both should work simultaneously... $\endgroup$ – Leander Sep 3 '19 at 10:58
  • $\begingroup$ @Leander it might work with some hooks, I haven't tested if vertex weights work $\endgroup$ – Duarte Farrajota Ramos Sep 3 '19 at 12:16
  • $\begingroup$ actually I think Spline IK will give what you want, I will try an explanation $\endgroup$ – moonboots Sep 3 '19 at 14:10
3
$\begingroup$

This isn't hard to do with the setup you already had, with all of your goals and limits, and what you have shouldn't be difficult to adjust-- maybe you'll understand better how to adjust things after reading this and working with it a bit.

From left to right: unposed; posed; posed with physics:

enter image description here

The hose is an arrayed object, curve deformed by a 3-handle bezier curve (although a NURBS should work if you'd prefer), parented to the outlet. The curve has stretch and bounds clamp enabled, and is parented to the same outlet. (This is important because for curve modifiers to work well, the first handle needs to be in the same location as the curve origin, so we don't want our first handle sliding about.)

The second and third handles are hooked (no falloff) to empties. For the third handle, this empty hook is then parented to our other outlet (inlet?) The empty in this case is optional, you could hook directly to the mesh object.

This gives you a structure where the hose follows both of its connection points, and gives an additional center point for you to animate yourself.

What about physics? Curves actually have a very good softbody implementation that allows for guidable physics. Start by setting the weight of both end controls of your curve to 1.0. (You can do this in the item tab of the sidebar while in edit mode with one or more controls selected.) Then, give the curve a softbody modifier. Finally, set your curve's physics settings appropriately-- you'll definitely want a goal default of 1.0, and you will probably want a goal Min of something larger than 0. Hit your timeline's play button and try it out-- and try move the central hook empty while playing.

Note that while this gives you physics on the curve, it doesn't give you collision-- your actual curve is just a line. You can disable rendering on the curve object and give it a bevel to create an actual surface to the curve for it to collide.

You could also skip the softbody physics and use rigid body physics, parenting your central empty to a rigid body (itself appropriately constrained to passive/animated rigid bodies).

With physics, you may see some inappropriate deformation of the tube. Dealing with that is somewhat out of scope for this question, and dealt with elsewhere on Stack Exchange, but one way to handle it would be create a spline IK armature or a skin-modifier created armature for your curve and use that instead of a curve modifier to deform your tube. This isn't as adjustable, though, as armatures don't have the same tools for non-destructive editing as curves do.

Edit: you can't give it a bevel to give it collision. It will only ever collide with the verts on the curve. To give it depth, you will instead have to scale up any collision meshes that might collide with it.

| improve this answer | | | | |
$\endgroup$
  • $\begingroup$ that's a great way of doing it, +1! $\endgroup$ – Millard Sep 3 '19 at 16:56
  • $\begingroup$ I get the issue where the wire (arrayed object) moves away from the bezier curve when dragging the outlet. The curve stays at the correct position after parenting, though. $\endgroup$ – qtjCH5pLao6 Sep 3 '19 at 20:42
  • $\begingroup$ @qtjCH5pLao6 The wire and the curve both need to have the same transform (just alt-r alt-g alt-s on both of them if they don't), with origins at appropriate positions (first handle of the curve, leftmost face of the mesh), with origins at identical world space positions, and both need to be parented to the same outlet object. Do not parent the mesh to the curve. But that's a "How to use a curve deform modifier without bugs" question. $\endgroup$ – Nathan Sep 3 '19 at 20:58
  • $\begingroup$ Probably best to ask that somewhere else, yes. Thank you for the answer above. Very creative. Have to fiddle with it a bit, but I'll comment if I get into trouble. $\endgroup$ – qtjCH5pLao6 Sep 3 '19 at 21:09
  • $\begingroup$ I gave the curve a bevel, but it still doesn't care about collisions. However, if I disable goal, it works, but then the curve is all over the place and not attached to the outlets. Any idea about what I'm doing wrong? $\endgroup$ – qtjCH5pLao6 Sep 4 '19 at 20:26

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.