[SOLVED] Forcing how an element to a skeleton outside?


I created a model in the md5 mesh and its animation works very well

I would like to add another element for example

Jewelry

But I wish that this move for example when you move the arm
In other words
Given the constraint of a skeleton that the jewels do not

Well… I think you are saying you would like to add more 'stuff' to it.



Easiest way would be to incorporate it into the model and let your modeling program handle the movement.  Then remove the add-on from the model but keep the key frames (possibly duplicate final model, and remove all vertices but add-ons).  This would make it so that it would follow the model animation but you could add and remove it at will; this technique will only work for models with the same geometry and same animation of course.  (If you have a woman running and a man jumping the add-on must, of course, move differently with each model)









Trying to add it into the scenegraph could be done in one of 2 ways.  Both are not super easy.



1st as the model is loaded (or post loading) traverse the parent node until you find the node that you would like to place the object.  Translate/rotate object and place object into that node.  It should then be translated/rotated with that node.



2nd Control the translation/rotation yourself by calculating where it should be in relation to the model at any given time.  This is the LEAST desirable method since you must know the coordinates it ANY add-on should be at for each frame and FOR EACH DIFFERENT MODEL.





These are some quick ideas I had for you, but I am sure there is a lot of different ways to accomplish what you want.



I try the translation rotation


But the animation for example, is not o same place if I do just the mesh
  Md5 the more I use jme contrib md5reader systematically request a skeleton for display element

I think I have found the solution

But I have a problem

I travelled my 75 animated image

And I travelled to the first bone

Then I add the following coordinated

Then the third, then the fourth, etc.

This should in theory worked yet

My jewelry and located in the throat and not on the wrist

protected void simpleUpdate() {
  index = bodyAnimation.findIndex(anim.getTime(), index );
          if (indexsave!=index){
              indexsave= index ;
       if (index> bodyAnimation.size())
          index = 0;       


  int vect[]= new int[4];

          vect[0]= 0 ;
          vect[1]= 1 ;
      
          vect[2]= 2 ;
          vect[3]= 3 ;
         
          transel.x =0 ;
          transel.y=0 ;
          transel.z =0;
          for(int i = 0;i<4;i++){           //4 bone to reach the wrist

      //index -->  keyframe  index  
                //vect[i]--> a bone

transel.x = transel.x+((SkeletalKeyFrame)bodyAnimation.get(index)).positions[vect[i]].x;

transel.y =  transel.y+((SkeletalKeyFrame)bodyAnimation.get(index)).positions[vect[i]].y;

transel.z =  transel.z+((SkeletalKeyFrame)bodyAnimation.get(index)).positions[vect[i]].z;
             
             
            
            
                accInstance.setLocalTranslation(transel);
          }
}
}



the picture

I use

    BodyInstance.addChild (accInstance, "Bone.003");

Allowing me to put my mesh on bone desired
But the mesh is still not the animation

If it is used in the update function in tracking the animation