Sliding Curtain Rail

By -
3 mins

With nCloth it is easy to make curtains that are attached to sliding curtain hooks. The basic trick is to use a slide on surface constraint with a long skinny surface for the rail. There is a bug in Maya 8.5 where slide on surface constraints stick along borders(this will be fixed in later releases). However we can still make this work by using two slide on surface constraints to two intersecting planes, thus avoiding the plane borders. 1. Create a poly plane and set its subdivisions to 30, 10. Rotate the plane by 90 in X.

2. MENU "Create Deformers: Nonlinear: Sine" Set the rotate on "sine1Handle" to 0 90 90. On "sine1" set: Amplitude = 0.1 Wavelength = 0.2 (this must be related to the subdivsions on the plane such that one gets a edges exactly on the peaks, troughs and center of the waves)

3. Parent the sine deformer to the plane so that it will move with it. (middlemouse drag the sin deformer onto the plane in the outliner) 4. Menu "nCloth: Create nCloth" with pPlane1 selected. 5. Create a plane with divisions 1,1 (one poly). Scale it to 0.1 in Z and translate up 0.5 in Y. Scale in X to 3.0 or to the desired range for the curtain track. Now duplicate it (cntrl d) and rotate the duplicate 90 in X.

6. Select one of the rail planes along with the vertices on the cloth plane that are just touching it. You can easily select this row of vertices with a single box select in the "right" window.

7. MENU: "nConstraint: Slide on Surface" On "dynamicConstraintShape1" set: Strength = 40 TangentStrength = 10 LocalCollide = OFF (important!. otherwise the constraint keeps trying to push the vertices off the rail) 8. Now repeat steps 6 and 7 constraining the same curtain vertices to the second rail. We need to constrain to the two rails to keep the slide on surface constraint from reaching the plane edges where it will stick (in Maya 8.5... later releases can skip this step and simply use a single very skinny rail). When you playback now the cloth should bob up and down on the rail. Now lets pin the locked end of the curtain and then try pulling it open and shut. 8. Select the top left corner vertice of the curtain and create a transform nConstraint, thus locking its position. (note it may be hard to see the selection under the constraint point draw) 9. Select a couple of points in the middle of the right side of the curtain and create another transform constraint. One can now drag the curtain open and closed by moving this constraint while running nCloth:Interactive Playback. (it is a good idea to hotkey interactive playback) Also before rendering it is a good idea to do "Mesh: Smooth" with "keep geometry borders" OFF.

This simulation is currently quite stretchy. You can improve it by increasing the stretch resistance, substeps and collide iterations. Also you may wish to have a little bit of damp. Also the friction is very low on the "curtain hooks". You can increase the friction on the slide on surface constraint to make it more like a real curtain.

editPfxOnPolyPath.mel parentToSurface.mel dynamicFollow.mel cameraFollow.mel confettiFall.mb oakBigLeaf.mel + oakBigLeaf.mel.icon bark.iff basicLeafHC.jpg birchBark.gif grassRoad.jpg leafSerrate.tif WhiteBark.tif sideleaf.rgb nClothVertexEditor.mel
Posted By
Published In
  • nCloth
To post a comment please login or register
| 5 years ago
Nice Bro. And Thanx A lot
Edited by mAhMfV9G 5 years ago
| 6 years ago
is there a chance that you make sliding curtain tutorial for 3D Studio Max? Would be very helpful :)
Edited by vrzX2twx 6 years ago
| 6 years ago
hey... how do you select the rail in object mode while you selecting the curtain in vertex mode??
Edited by ePxwrdaL 6 years ago
| 6 years ago
technical, thanks sir
Edited by IBa8Vudg 6 years ago
| 10 years ago
really effective tutorial..
| 11 years ago
thank you for all your tutorials... you are "the master" of ncloths. thank you very much.
*Save $66 per month on Autodesk's Suggested Retail Price (SRP) when purchasing 1 year term 3ds Max or Maya subscription.