View Full Version : Ncloth constrained to one axis

05 May 2010, 05:09 PM

I'm trying to get a set up with a huge grid of planes all individually constrained to x rotation only, so that you can apply fields to the whole area and get some nice organic/random effects, kind of like a mexican wave when crowds hold up square cards and flip them but in this case affected by wind/turbulence instead of being manually flipped.

Ive tried using rigid bodies with all the other channels disconnected and it looks VERY shit... all the planes move together as a group, and volume fields don't seem to have any effect.

Anyway wondering if there is a better way to do this. Ideally i'd like to do it with ncloth but you don't seem to be able to allow disconnections? Or is there a constraint that will do it?

any ideas?

05 May 2010, 01:03 AM
make each card 2 faces and constrain the centre 2 verts.


05 May 2010, 12:50 PM
Hi thanks

works a treat on an individual plane/ flat cube. Just what i need.

although i'm having problems duping them up...i need about 400 of them (in a grid) . I've tried duping them as individual objects with input connections but it seems only to work if you make hundreds of indiviudual ncloth objects. Unless i'm doing something wrong? I've also tried doing a polycombine and put in each constraint by hand (eek) and it still doesn't seem to be reacting to fields.

Is there a general workflow for multiple constraints like this?

05 May 2010, 01:35 PM
I liked the sound of John_Homer's idea of constraining the two center verts to get a spinning card.

So I gave your problem a go.
Create your 400 cards (each made of 2 polys) and arrange them in a 20x20 grid (dont overlap).
Combine these into a single mesh and delete history.
Make it a cloth object.
Give it a high bend resistance, and maybe increase the drag (keep tangential drag low)
Select the center 2 verts in each poly shell (can do this pretty quick with a marquee and the shift key).
Create a single transform constraint.
Create a volume axis field (from the nDynamics menu)
Hit play and increase the field magnitude and maybe a bit of turbulence.

(I tried the nucleus wind, but it was not very successful. Volume Axis works great though)

Its a nice effect with each card spinning differently. And it solves really fast.
You can animate the direction of the field and the amount of force.

If you need thickness, do an extrude on the cloth object (rather than before you make the cloth) so that it happens after the cloth solver.

edit: Actually the extrude thing does not work as I expected. The face normal changes as the cloth spins, so the direction of the extrusion changes. Hmm...

edit2: I'm loving the effect though. Try lowering the constraint strength to let the pivots spring around a bit. Now that grid of cards looks much more organic.


05 May 2010, 01:47 PM
Wow thanks for that!!

Finally got mine working, turns out i just had to clear the cache, for some reason ncloth stopped entirely, possibly because of a previous cache. Soooo much better than the rigid body version, shame I went and manually put in all the constraints in when i could have had just one - doh! and double doh!

05 May 2010, 02:42 PM
anyone got any ideas on how to make the cards rest on their rear side (180 rotation) so the whole image changes from front to back (ie front side> volume axis> resolve on rear side?) I've tried using another mesh with the faces rotated as a rest shape, but cant seem to get it working...

05 May 2010, 11:16 PM
If I understand you correctly I don' think you want to use a rest shape.. that won't affect card rotations, just the internal stretch/bend angles of the cards. What should work is an attract to matching mesh constraint.

Also for the extrude problem... it helps to add another construction history like setting the normals soft/hard before doing the extrude. The extrude history then gets the proper vertex normals. I'm not sure why, though.


05 May 2010, 11:53 AM
Thanks, v useful.

I'm having trouble trying to get the cards to rest upside down. Ideally i'd like them to spin on their constrainted vertices and rest on their underside. So if all the cards are in a grid and their top side was white, their underside black, the volume axis could flip them all over and their final rest position (ie the state they would be attracted to) is black on the top side and white underneath. Voila, nice little transition.

What i was trying to do was rotate each card in the mesh ( ie going back to the orginal uncombined mesh and flipping them all over then recombining) and hoping the resulting mesh could be used to attract the cards to an 'upside down state'. But is this topologically incorrect? The attract to matching mesh doesn't seem to work when i try it.

Maybe i'm going about it the wrong way, should i be looking at an expression in the texture map or some kind of pressure map to make sure they all rest flipped over?

05 May 2010, 08:37 PM
Here are a couple of files that I think do what you are after. They both use ncloth with two face cards constrained at the center vertices to create a hinge. To push them towards the initial position I use inputAttract and to the push to the flipped position I use a force constraint applied to the vertices on 1 edge of each card.(do constraint select members for the first constraint hit the right arrow then create a force constraint)
The force constraint has the force value set negative so it sucks towards the constraint center. (unfortunately there is not a force direction on constraints... it is always concentric)

In one file I simply move the force constraint, in the other I put a ramp texture on input attract and animated the ramp values to create an animation. (you could use a file texture with an animation desired)

One could perhaps more easily set this up by using expressions and non-dynamic animation techniques, but a nice side effect is that the cards wobble and have secondary effects that you can control. For a more human like effect you could lower the intensity of the first constraint and add some drag and wind noise, so the cards are never quite still or perfect.


05 May 2010, 11:49 PM
just thought Id take DJX scene and turn it into a fire emitter, thanks ;)

05 May 2010, 12:08 AM

Gotta say, thanks so much for all your help everyone...cant believe the response i've had, it's competely expanded my knowledge of ncloth.

Duncan... that was exactly what i was looking for, and i think doing it dynamically definitely gives it that edge....i have plenty of experimenting to do with this.

CGTalk Moderation
05 May 2010, 12:08 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.