Trouble constraining bones to vertex groups.

I have:

  • A mesh, with a vertex group.
  • A bone.

I want the bone to behave as though it were “parented” to the group of vertices.
The “Copy Transform” constraint cause the bone’s location to follow the average position of the vertices. This is good… but … the bone doesn’t copy the rotation of the vertices.

I would expect that its global rotation correspond to the average of the of the vertex normals. This does not happen - I’m guessing that there’s some sort of space switching issue, but I don’t know why- I set the constraint’s “source” and “target” fields to “global”. If I set the constraint to “offset” I get something better- the bone points straight out from the mesh- but the bone still rolls on its y-axis, and if I rotate the mesh into the correct configuration, the bone starts rolling into the mesh.

The Blender WIKI seems to suggest that this kind of constraint is do-able, so is there something I’m doing wrong?
http://wiki.blender.org/index.php/Doc:2.6/Manual/Constraints/Transform/Copy_Transforms
http://wiki.blender.org/index.php/Doc:2.6/Manual/Constraints/Transform/Copy_Rotation

“Child Of” doesn’t work either.

Normally Armature (the rig) is parent of whatever the mesh one wishes to control. When parenting relationship is made, Blender links bone to mesh using vertex group, and adding Armature modifier pointing to give rig, on to the mesh object. Each bone that controls the mesh must have identical vertex group name.

Process is little different if the rig does not have parent child relationship to the vertex group you like to constraint to. You need to make parent child relationship to a bone.

It sounds like you’re trying to control a bone with a mesh. This is the reverse of the normal procedure. The whole point of bones normally is to control the mesh, not the other way around. What exactly are you actually trying to accomplish here?

This is common practice in other software.

Say you have a fat character with a belt. Maybe you have the belt weighted so that it moves with the character’s body, or maybe they’re both being deformed by a cage deformer. That’s fine.
Now, if you want to add a belt buckle, what do you do? You can’t deform it with the cage because it will warp. You can’t parent it to a bone because the mesh in fat characters is usually weighted to more than one bone.

One way of doing this is to constrain a bone to a small group of vertices (on the character’s belly) and then parenting the buckle to the bone.

Blender has this kind of constraint available (when you constrain something to a mesh object, you can select a vertex group), but I can’t stop the bone from rotating unpredictably.

I set it up like so.
But its like the vertex normals are affecting the bone rotation.

Same thing happens with the Copy Transforms bone constraint, local to pose.

Attachments


Can’t you just create separate models and separate bones for each part. I think it would be easier and less confusing that way.
Your method of controlling a bone with a mesh might cause some future problems when you want to remove the bone or mesh.
Other mesh that is attached to the bone will be affected too and vice versa.
Just my opinion.

Blender has this kind of constraint available

I made a button object. On it I used Child of constraint to attach it to body object, which is rigged, through vertex group. It works. Which constraint did you use?

Thanks for your suggestions! Unfortunately, I tried both your methods and neither works. In your depicted example, the polygon is flat with the ground (and therefore aligned with the axes of the containing mesh object). Edit the polygon to a 45 degree angle.
You’ll find that when you deform the mesh, any rotation on the global-z axis will cause the bone to tumble.
I attached a sample .blend file at the bottom. Try it out.

Try your second setup in my example. If you rotate the root bone around, you’ll find that there’s always an orientation where the rig breaks :frowning:

“Copy transform”, “Copy Rotation + Copy Location”, and “Child Of” all put the bone in the correct place, but also make the bone rotate strangely.
How did you set it up?

constrain to vertices.blend (505 KB)

Ya you are right. Button object do roll. I didn’t see it because the object was round. Here is the file. http://www.pasteall.org/blend/25487

I did some more testing. The constraint works fine if you rotate the entire mesh object. So the constraint is only stable if there’s no deformation.

I can’t find any information which tells me whether or not deformations are supposed to be supported. I can’t find any versions of Blender where this does work, so maybe it’s not a bug. But then again, the feature has very little use if deformation isn’t supported (because you can do the exact same thing by constraining to the entire mesh object), so maybe it is a bug.
I figured it was worth a shot, and reported it.

Thanks for your help, guys.

I don’t believe you can currently use any of the constraints to achieve what you want to do . But you can use vertex parenting to produce somewhat the same results . It doesn’t seem like none of the constraints averages out the normals for a given vertex group for them to behave in a predictable manner like it does when you use the Normal view of the 3D widget .

You just have to plan ahead a bit due to the fact that you can only vertex parent to either one or three vertices an not an entire vertex group . But you can select any three vertices in any particular vertex group and parent them to a bone . You will probably want to use three vertices that will be the best representative plane (3 vertices = a plane in 3D space) for a vertex group if you want the bone to follow the possible rotation of the mesh/vertex group during deformation .

To set up vertex parenting :

  1. select bone/object
  2. shift-select mesh
  3. tab into Edit Mode for mesh
  4. select either one or three vertices you want to parent to
    5)Ctrl-P to parent vertices to bone

I modified your file below using vertex parenting . In the first one I left the topology of the mesh intact and just selected three vertices from the plane (ConstrinGRP) . But the problem with just doing that causes the bone to flip with the tri (the vertex_parent vertex group) that bisects the plane when rotating the bone along it’s local axis . To fix that in the second blend I made a loop cut to center the tri within the plane and added the central vertex to the tri instead so the flipping stopped .

constrain to vertices_vertex parent.blend (509 KB)
constrain to vertices_vertex parent_LC.blend (511 KB)

Thank you! I didn’t know this existed, and it’s exactly what I needed!

Interestingly, when you only use one vertex, the child object doesn’t inherit rotation. You need three verts to define all the degrees of freedom.