Manually rotate bone does not update spatial/model

Some help needed. I want to manually rotate bone in skeleton via java code, but in final result the bone rotates, but the model does not update accordingly.

Result:

What I have done:

  1. model the spatial in the blender: create objects, create skeleton (everything according to jme3 documentation - root bone etc.), create parent for each element of the model via bone parent (NOT with armature deform with automatic weights because i do not want model to deform, only to move accordingly).
  2. export model via OrgeXML export. I have many single elements exported (not single mesh)
  3. i have imported each element to Jme3d SDK. Each element has it own SkeletonControl (?).
  4. i have created scene and put each element onto the scene. All of the elements have built whole model.

The scene hierarchy is as follow:

Next i have load the scene into the jme3 application. And the exemplary code for rotating bone is as follow:

[java]
SkeletonControl control = rootNode.getChild(“ramie_P”).getControl(SkeletonControl.class);
Bone bone = control.getSkeleton().getBone(“b_ramie_P”);
bone.setUserControl(true);
Quaternion q = new Quaternion();
q = q.fromAngleAxis(FastMath.HALF_PI, Vector3f.UNIT_X);
bone.setUserTransforms(Vector3f.ZERO,
bone.getLocalRotation().mult(q),
Vector3f.UNIT_XYZ);
[/java]

It is bind with the key press. In the skeleton debugger the skeleton shows, after pressing button the bone rotates (as in the first picture) but the model does not update accordingly.

What is wrong with the mentioned steps ?

  • The bone parenting in blender ?
  • Exporting from blender to ogrexml each element alone ?
  • Creating whole model from scene ?
  • Something in the rotation code ?

Thanks for any tip.

After fiddling in the exported ogrexml files I see that in the mesh export there is no bone assignment e.g.:
[java]
<skeletonlink name=“organ_P.skeleton”/>
<boneassignments>
</boneassignments>
[/java]

So I suppose i should have armature deform parenting type not bone parenting ? I have avoided this kind of parenting, because when i have created such parenting, the model was deformed and I wanted only mesh movement.
So maybe i should avoid such skeleton stuff and only rotate/move spatials ?

Ok, maybe this will be some kind of monologue, but.

Basically I want to use the skeleton as a helper for positioning the spatials. I do not really want to deform the spatial with skeleton.

So … maybe i should use the skeleton as a helper and in update() loop i should transform bones and for each bone I should get transformation data and apply it to selected spatials ?

in blender you do this by just not assigning the root bone to any verticies (or whatever bone you want to move), easiest way to do this is to unclick the “deform” option when making the bone. but if you already have the rig then you’ll have to figure out which vertex group is assigned to it and delete the vertex group.

youll however need its child bones to be fully assigned to all of the verticies, or it will warp and deform.

when you weight paint your mesh you’ll want to have the “automatic normalize” feature turned on (this ensures the weight of each vertice adds up to 1 across each vertex group), and of course make sure you paint everything. You’ll probbaly need to experiment around with pose mode to make sure you did it all correctly and that it looks reight when rotating each bone.

i just recently started feeling like ive mastered weight painting, its hard to do but once you learn the right tricks it gets easier.

1 Like