# How to simulate a rope?

I'm trying to simulate a rope (that later might get pulled on the ends*) that interacts with some obstacles. So far I created a plane as the floor and a cube as an obstacle, and activated "collision" in the physics menu for both of them.

*(In the end the goal is simulating a string & wire puzzle.)

For modelling the rope, I tried using a long cylinder with enough subdivisions, and activate "cloth" in the physics menu. This resulted in the cylinder collapsing like a sleeve of a sweater, but I would like the cross section to remain roughly circular. Is there a way to directly avoid this?

Another approach I tried now was just using a a line made up of vertices and edges (with the idea of later adding modifiers to give it a thickness), but this just fell through all the collision objects as it has no faces. Is there good way to do this?

Create the rope using a string of vertices controlled by a Soft Body simulation and pin the ends to provide some control. Give the 'rope' thickness by adding Skin and Subdivision Surface modifiers and use the Collision bounds of the other objects in the scene to control the thickness to match. This is very similar to How to get the physics engine to wraps a string around the moving part of a motor constraint? but using two control points to control the ends (rather than bonding one end only to a rotating spindle).

Start with a string of vertices - the easiest way of creating this is to add a Path (Add/Curve/Path) and Convert to Mesh (Object/Convert To.../Mesh). Position and sub-divide the mesh so as to space the vertices a similar distance apart to the desired eventual rope thickness (this helps with self-collision as well as controlling the overall behaviour of the 'rope').

To be able to control the rope we need to pin the ends to something (empties) to act as handles. Moving the handles positions the end of the rope. To achieve this, go into Edit mode (Tab) and select just the end vertices of the path.

On the Mesh properties panel, add a new Vertex Group and click Assign so that the 'end' vertices are part of that group. At this point you can rename the group (double-click its name) to something meaningful like 'Pin'.

Select each 'end' vertex in turn, press Ctrl+H to bring up the Hook menu and select Hook to New Object. This will create an Empty at each end of the path.

In Object mode, select the path and add Soft Body Physics in the Physics properties. In the Soft Body Goal settings set the Goal Strength Default to 1.0 and the Goal Settings Stiffness to maximum (0.999). Set the Vertex Group to the 'Pin' vertex group created earlier.

In the Modifiers panel ensure the Hook modifiers are 'above' the Soft Body modifier.

Now, run the simulation and you should have a soft body string connecting the two empties. Moving the empties should affect the string.

To give the rope some thickness, add a Skin modifier and a Subdivision Surface modifier for smoothness. To control the thickness of the rope you can select the vertices in Edit mode and adjust the Radius X and Radius Y properties in the Properties panel (N).

For collision with surfaces, the actual collision occurs with the inner 'core' of vertices of the Soft Body (rather than its Skin), so adjust the Outer collision bounds to match the thickness of the 'rope' to compensate. To prevent the rope from cutting through sharp edges, enable 'Edges' collision in the Soft Body Edges properties panel.

Care needs to be taken with the collision to ensure the collision 'zones' from each surface do not 'leak out' of the opposite side of the mesh. See soft body collision considerations for further detail.

For self-collision, enable the Soft Body Self Collision settings and adjust the Ball Size to suit the thickness of the rope (this controls the 'size' of each vertex in relation to the length of it's connected edges - hence why spacing the vertices close to the thickness of the eventual rope is helpful).

Moving the empties along a path will now 'drag' the rope and this can produce the following results :

Blend file included

You can calm the softbody simulation to stop it wiggling around so much by adjusting the soft body parameters - for example, by increasing the damping or, in this case, increasing the Friction :

This takes some of the energy out of the motion of the rope, damping down its movement :

To texture the rope you can use Generated coordinates. The Generated coordinates are distorted to match the animation, following the motion. For example, consider the following material :

This uses the Generated X coordinate to determine the distance along the rope and uses the Maths Arctangent to convert the Y/Z coordinates into the angle around the circumference of the rope. These are combined and passed into Color Ramp nodes to generate the twists around the rope. This can then be used to generate a Normal using the Bump node and/or passed into the Displacement socket of the material to use the (experimental) True Displacement feature to displace the surface.

This can produce the following result :

Blend file including displacement

(Note : Blend file has soft body Edge colllision and self collision disabled to drastically increase speed of simulation - re-enable by clicking Edges in Soft Body Edges properties and re-enable Soft Body Self Collision)

• Super answer... Jan 13, 2018 at 9:23
• This is great, thanks a lot for your extensive answer, I think my mistake was in the order of the Hook and SoftBody modifiers. I'm gonna have to try it as soon as I'm at home:) Also your explanation of the distances of vertices/"balls" makes are enlightening! Jan 13, 2018 at 10:25
• @RichSedman how do you stop the wiggling?
– user1853
Jan 13, 2018 at 16:49
• @cegaton Adjust the "Soft Body Damping" slider in the Collision settings. Jan 13, 2018 at 20:04
• @cegaton The simplest way to calm down the rope is to increase the Friction on the main Soft Body parameters. This effectively damps down the motion. I've re-run the simulation and updated the answer with an example (with Friction increased from the default of 0.5 to 25). Jan 13, 2018 at 21:38