I'm generating skeleton programmatically for existing mesh. When Bone is created it is placed in the origin of the world coordinate system. I have trouble moving it into appropriate position. Whenever I call
Bone b = new Bone(elements[index].getName());
b.setLocalTranslation(new Vector3f(x,y,z));
it moves the skin mesh too (and effectively destroys the figure composition). I call
skinNode.addBoneInfluence(index, v, b, 1);
later, so the bone relocation shouldn't affect the skin, right? Or is there some other way to position bones that I'm missing?
1 Like
I think I had similar issues using the Bone Animation system in jME… It worked sometimes and sometimes it had issues. In the end I had to write my own system for OgreLoader.
1 Like
Still fighting. The TestSimpleBoneAnimation.java example is of little help. The mesh is essentially random, so it is hard to notice that translating the second bone actually distorts the mesh. I tried with a cylinder in 1.0 (by arranging cylinder geometry in two batches), and whenever I move the bone, it distorts the cylinder shape. The only way to correctly bend the cylinder is to leave all bones in the the origin (that is Vector3f.Zero). I guess in 2.0 I have to experiment on a similar example with a skin from two cylinder parts and skeleton with two bones…
I suspect the only way to correctly construct a figure with bone structure is to have all the parts centered in the origin, and then translate the bones into correct positions (which would trigger the skin pieces into the correct places as well). Can somebody knowledgeable with collada importer confirm that this is the way it works when creating a figure from .dae file data?
1 Like