Attach Object to Animated Pg

Hi, i have seen some post that says that to attach objects (like weaponts) to pg you need to use the scheleton, but i have no idea of what methods i have to call.

To be precise, this is the situation of my work, this is what i'm able to do:

do a model with something.

import it in milkshape

import a scheleton (unreal turnament scheleton is a good idea?)

attach the scheleton and animate the model

save the file

load the model in jme with the code taken from TestMilkJmeWrite

see the animation working properly.

suppose I want to attach a weapont, that is in another file( it do not need a scheleton since it is not animated itself, right?)

what is the code that i have to write?

Thanks in advance ! :slight_smile:


ok I was able to turn around the problem.

i have made a pg with the sword as two different object in milkshape,

all vertex in the sword are joined with the same point of the scheleton (that is if you want a solid item…)

then I charge the model in jme,

then when I need to change the weapont to another I call a swap function that do this:

((Model is a class that I use for ordering the stuff and that simply contians a TriMesh and a set of RenderState))

    public static void swap(JointMesh targhet,Model mm){

      TriMesh m=mm.m;

      int n=targhet.jointIndex[0];

      //result=new JointMesh(m.getName());








      targhet.jointIndex=new int[m.getVertexCount()];

      for(int i=0;i<targhet.jointIndex.length;i++)


      for(RenderState rs:mm.renderStates)



Is there a better way?

I do not think that in my game change weapont is going to be a frequent used operation, so is better to improve the precision in position of the weapont+the speed to draw the animation more than the time needed to change the weapont…