The slinky is a special type of near zero tension spring. It is constructed with a flat ribbon of metal that resists shear and bend in the ribbon plane but easily bends down the axis of the spring. We can simulate it with nCloth by constructing a long spiral cloth ribbon and giving it similar properties.
1. Model the slinky
We can model the slinky using one of my favorite tricks, which involves creating a spiral using only a 2 cv curve on a nurbs cylinder.
a) MENU "Create: Nurbs Primitives: Cylinder"
b) MENU "Modify: Make Live"
c) MENU "Create: Cv Curve Tool"
In the options set curve degree to 1. Then add a cv to the top and bottom edges of the cylinder and hit enter to create a 2 cv curve on surface. Now comes the fun part.


f) Scale up the second duplicated curve in X and Z (1.2, 1.0, 1.2) One can scale in x an z only by dragging the Y (yellow) scale box while holding the control key.

You now have the basic slinky shape, but nCloth needs a poly mesh, not a nurbs surface.

Initially we have way too many polygons. It is critical that we triangulate the nurbs to get the most efficient mesh for simulation. On the created nurbsTessellate node set the following:
Enable Advanced Tessellation = ON
PolygonType = Quads
Format = General
General Tessllation Options:
UV Type = Per Surf # of Isoparms in 3D
U Number = 414
V Number = 1


2. (optional) Apply a bend deformer to the slinky: MENU "CreateDeformers: Nonlinear: Bend" (You can use the deformer to pose the start shape of the slinky, however it will not be used in this tutorial)
3. Select the slinky ("nurbsToPoly1") and do MENU: "nCloth: Create nCloth".
Enable "Use Plane" on the nucleus node for ground collisions, move the slinky above the ground plane and playback. At this point it looks more like a cloth slinky than a metal one and has some self collision problems as well.

selfCollisionFlag = "Full Surface"

Max Iterations = 10000
Then we can set the stiffness related attributes high. In particular shear resistance is helpful because the stretch crosslinks cannot stiffen the skinny quads as much as we would like. (normally shear resistance is not needed because the more efficient stretch/compression cross links keep quads from shearing) Bend affect how much the slinky pulls apart, and doesn't need to be as high because the metal ribbons can bend much more along the flat side.
Stretch Resistance = 3000
Compression Resistance = 3000
Shear Resistance = 1000
Bend Resistance = 500
Also we increase the mass so that air drag has an insignificant effect.
Mass = 10
6. Set the general scene scale and collision quality. The slinky is now stiffer but still has collision problems when we playback. On the nucleus node change the following:
Substeps = 20 (For the finished animation you may wish to bump this to 100 or more to avoid self collision problems, but 20 was enough to create the avi in this demo)
SpaceScale = 0.4
Initially the slinky was 2 meters wide in term of dynamics, the space scale of 0.4 makes this .8 meters wide, which is still a very large slinky. However the net result is that gravity is not quite so strong and things move a bit in slow motion. If you really want to simulate at full slinky speed(small things move fast) then make this lower and increase the stiffness attributes as well as the substeps.
7. Create the passive scene geometry. In this example we wanted some stairs. This can be quickly created by setting the subdivisions on a plane and moving cvs in a side ortho view. Although any method should work fine. Just make sure that the normals face outward( towards the slinky.. if you collide with both sides then turn off trapped check on the nRigid ) and that the poly count is not excessively high. The steps should be just a little wider than the slinky. When done select the geometry and do "nCloth: Create Passive".



10. Smooth and thicken the slinky for rendering.
First smooth the slinky: MENU "Mesh: Smooth". On the polySmoothFace node turn OFF "Keep Geometry Borders".
Now thicken it: MENU "Edit Mesh: Extrude". On the polyExtrudeFace node turn ON "Keep Faces Together" and set the "Local Translate" to 0 0 0.028. (this is the nCloth thickness). Note that everything done to this point has history, so you can go back and change the total number of coils by editing the curve cv position, or deform the shape of the original nurbs cylinder, etc. Of course this will require re-caching the simulation.

excellent tutorial duncan.
I’d like to apply some of the same functionality to a spring I’ve built that is attached at both ends to two different pieces of geometry - so that it stretches out kinda like slinky but maybe a bit stiffer so it doesn’t sag in the middle - i’m not clear on how to constrain it to my two pieces of geometry so i can see the deformation in real-time. maybe I should just go with a wire-deformer instead?
Hi Duncan, another impressive tutorial and demo. I’ve always wanted to simulate a slinky going down some stairs with dynamics but never fully hashed it out with the current dynamics system. I also saw the skinning demo with nCloth at GDC and asked Steven about getting a copy of the script, which he replied with a grin and said that it was created by a game studio for Autodesk to use in demos. He showed the animated hell-hound walking and simulating the neck thing in real-time (sweet demo)…
I look forward to the performance updates in nCloth and hope you keep creating these amazing blog posts. Outstanding job as a whole and that guy talking about Ron Fedkiw just doesn’t understand the work involved with these simulations.
May all your attempts be sub-linear. All the best.
Brian… That GDC demo was by Steven Roselle, who is currently working on a bonus tools script to do the automated setup( although I can’t say when this will appear in bonus tools). Basically the workflow he describes initially constructs a surface (using a loft) based on multiple skeleton chains. The surface is made into nCloth and the output nCloth mesh is used to drive the skeleton. His script has different options for the way this is set up, but the closest match to the cloth involves point constraining the joints to the cloth surface.
Hey Duncan, great tutorials--
I’ve been playing with ncloth for a few days now, and I think we are going to use it in our pipeline.
I saw an Autodesk demo at GDC where they cached the ncloth simulation and attached the cache to a skeleton--almost like a reverse skinning operation. I don’t know if you have a link to the video, or know how to reproduce that effect.
We need to bake the simulation, and get it into an FK based game engine--so this feature is key.
Mason… did you move the slinky above the groundplane before simulating? If not it would get pushed up the way you describe( I’ll fix a typo in step 3: “above” not “about” ). I would not get bent out of shape over the speed in this example. A slinky is actually a challenge to simulate and requires extreme settings for stiffness and quality. Vertically the slinky hits many layers of self collision. It is a thin ribbon, yet needs the stiffness of steel, so stretch/compression resistance is 3000, which is the highest I’ve used on anything. The number of internal solver iterations is proportional to the stiffness levels, so for high stiffness it can be slow (for very high stiffness one can use the rigidity attribute, but that wouldn’t work for a slinky). We are working on some new solving methods that could dramatically speed up this example (although I can’t discuss when this might appear in Maya). Also note that in the example file there is downstream construction history (a smooth and extrude) that also slows it down a bit.



