View Full Version : Keeping Buttons on Attached to clothing

10 October 2005, 02:50 PM
I have a character I am working on that is wearing a pajama jump suit.

On the front there are about 5 buttons that go down the center.

With a basic bone set up they distort with the mesh wich is not what I want.

So I add some little bones to each button so they retain their shape.

The problem is that they don't stay attached to the mesh perfectly when it is moved.

I.E. When the character bends backwards, the buttons float away from the clothing.

I want them to move WITH the mesh, but not be distorted.

Any ideas anyone?

I'll submit a pict if anyone needs it.

10 October 2005, 07:32 PM
put more edges into the cloth mesh alligned with the buttons (vertices under buttons). if you have a button in the middle of a face and not close to any edges, obviously your button will "raise" off the surface when you deform the mesh.

10 October 2005, 09:16 PM
I don't think more mesh will solve the problem in this case, as the further you go from the bone, the less influence it have, it will still be deform.
The trick is to find a way to make rotate/move the button, but in a "temper way".
I already dealt with this kind of stuff, it was button+some sort of "bag"

Take out all your buttons from the original mesh, and create a new object out of that, in LW.

In messiah, import this new object, and isolate each buttons with a Meta Effector for each one. (chose field of influence-->All connected).
Use Bone Deform, than create Bones that will control your buttons with target object option-->Direct Weight, to make sure that no buttons will be deform.
In my example, BONE C is "the bone" of the bag (use the Meta Effector as the weight for the bone)
BONE C is the children of BONE A. Then with expressions, when BONE B rotate, BONE C rotate about a half on Heading and a third on Pitch, depend what is needed to make the bag (or button) to be part of the suit.
So BONE C is controlled directly by BONE A, and by BONE B with expressions.
Well, of course the BONE C have no influence on the character mesh, just on buttons/bags.

See an example on one rotation angle, how the bag seem to be part of the mesh...

I have several characters more complexe, with more details, and it's working really fine !

Hope that will help, or get you on the track of a better way that suit you better. ;)

10 October 2005, 02:53 AM
oooh cool tip phenobarbidoll
thanks :thumbsup:

10 October 2005, 03:20 PM
Thanks Pheno.

I think I figured something out that's a lot like what you showed here.

I made the buttons a seperate object like you said.

I applied their own bone deform effect vs. applying metaeffectors. I haven't had a lot of luck with metaeffectors. They stay completely rigid this way.

I parented their bones to the spine bones of the body.

I created muscle bones from the body's bones effect and targeted them to the button's bones.

I applied some simple expressions that made certain "button" bones move on various channels based on the movement of the spine bones so when the buttons move, the cloth pulls to the button, but not past them.

Very pleasing results so far based on forward and backward pitch rotations of the spine.

I have to do some more work as far as heading and bank rotations because right now they just stay vertically straight.

I'll post something when I have finished.

10 October 2005, 03:34 PM
your solution is far too complex. just parent the buttons to the bones extending from the spine but have these bones affect the body as well. this will keep the buttons in place. you just have to play with bone limited range and strength.

10 October 2005, 05:01 PM
I recall that mark wilson wrote a few expressions plugins to deal with this.

the caveat was that you needed the vertex ID before you could attach the item to geometry.


10 October 2005, 07:47 PM
:eek: woww, what you described sound just great Joe !:eek:

I have Messiah Animate 4.0e, does this "expressions plugin" work with this version?
Hope to hear more about it...

10 October 2005, 07:01 PM
That is exactly what I'm looking for Joe. Mark, hello!.

I have thought about doing it as a post effect in Lightwave using the cloth dynamics.

I am going to apply cloth dynamics to the suit. In the edit FX area you can take the path of a specific point and apply that to something else, ie. a button. That would keep the button completely rigid, but let it move with the rest of the cloth.

Anyone tried that.

P.S. I would like Mark's version better if it works.

10 October 2005, 10:44 PM

I did write a solution. Long time ago though so don't expect large amount of help from me. The plugin is called DynamicFUNC and I found it here: (

This plugin adds four new functions to the command tab function list
and script function list:


These are dynamic versions of MoveTo and Align, plus a dynamic IK limit func which is good for Motion Dynamics and more complex IK rigs. Finally, with MW_Vertex_Attach you can move objects to mesh vertices!
Each one has a description of what it does when you select it to use it in the command tab.

Mark ;-)

10 October 2005, 01:56 AM
That's kick ass, Mark. Thanks a million. I am going to try it as soon as I get my kids to bed.

I did try the edit FX theory I talked about in Lightwave. It worked great too, but seems like it would be too many steps to have in a full production.

For those who haven't tried it you might want to test something just for grins.

Apply cloth or soft body dynamic effects in Lightwave. Run the simulation until you like it. Go to the special or ETC tab ( I can't remember) and look for the Edit tab. When you click on the edit tab you can select any point on the object. When you select that point you'll notice a number appear below the edit tab that shows which point you have selected. Next go down to the "command" tab and select "make path".
When you choose "Make Path" a null is created that matches that specific Vertices' animation.
In the scene editor you can then parent whatever object you want to the null and it will then be attached to the dynamic movement of the cloth.
This works for particle effects as well.
Pretty cool. The downside is that you would have to create one for every vertices and every object you wished to have attached to the mesh. Not so good if you had to make a lot of versions. Every time you made a change to the cloth calculations you would have to save out new paths for the vertices as they are creating motion paths with keys on every frame.
Pause. Take breath. Exhail.

Having said all that, if Mark's plugin works I would much more prefer that.

10 October 2005, 04:33 AM
Holy cow, Mark.

I just wet myself from a brain overload.

I know zero about scripting or applying anything in the command line. I'm in the process of reading about it all right now, but it's a little intimidating right now.

If anyone has any good advice on how to do this and what all of this means, please let me know. Thanks.

10 October 2005, 05:37 AM
After Reading and experimenting a bit I got the function to work in the expression list.

MW_Vertex_Attach(Max_Button, Max_Suit, #85, 1)

It attaches, sort of.

It seems to have a lag to it as in: it doesn't keep up with the animation of the suit mesh.

I'm over exagerating everything right now just to see how well it keeps up. The real animation probably wouldn't be that speedy, but you never know.

Also, it doesn't align at all. It "moves to" the point, but doesn't align it with the point's trajectory. I.E. in theory I think it would align itself to the vertice similar to a polygon's normal.

If you had a bicycle pedal you wanted to attach to a point on the end of a crank, it would work perfectly as far as the align goes.

More than anything it's the lag that disturbs me. It's even worse of a lag when I scrub, but after reading the minimal documentation on functions and scripts it sounds like that is fairly normal as they are slower than actual plugins or expressions.

Of course it could be something I'm doing wrong.

P.S. if anyone wants to know how I got the point ID of #85, I basically selected the point in modeller and clicked on the info button to get its number, wrote it down, and typed it into the expression. You guys may be smart enough to have figured that out, but I thought I was down right clever for a few seconds. :)

10 October 2005, 07:12 AM
I think you need to bake the motion once the expression is applied, then remove the expression adn you shouldn't have the lag. To align the button would be really easy to add but I simply don't have time. maybe some other coder would lke a try.


10 October 2005, 09:10 AM
For aligning the button you can use another vertex that defines the 'up vector' of the the button. You can do it like that:
1. Create a bone 'Bone_Attach' that is parented to a spine bone. Set its slip to 1, since it shouldn't have any influence on the mesh.
2. Create a null 'Null_Attach' that is parented to the same spine bone.
3. Parent your button to 'Bone_Attach'.
4. Add the following expressions:

MW_Vertex_Attach(Bone_Attach, Max_Suit, #85, 1)
MW_Vertex_Attach(Null_Attach, Max_Suit, #80, 1)
Target(Bone_Attach, Null_Attach)

This assumes that #80 is the number of a vertex that is close to vertex #85 and positioned above.

Now 'Bone_Attach' and the button should be aligned to the mesh. It *might* be that under some circumstances the button flips (as there is only an 'up vector' defined ), but you can give it a try.

10 October 2005, 04:08 PM
It seems there may not be an easy way to pull this off.

I hate to give up because I'm sure there is a solution.

That targeting thing gave me a couple of ideas however. Thanks for the info.

With all of the baking and so forth, I might do this as a post animation effect within Lightwave. Unless, of course I can get it to work in Messiah.

Here are a couple of screen grabs from a test I did in Lightwave yesterday based on the steps I described earlier.

CGTalk Moderation
10 October 2005, 04:08 PM
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.