MS3D Character Control Animation

Hi,



  I have been successful in exporting the entire Milkshape 3D model through TestMilkJMEwrite.java. Now I need to have mouse control for every body part of the exported character, i.e if the user selects the hand, he is able to rotate the hand etc. Are there any demos demonstarting similar programs ? Closest was TestSceneGraph where I could rotate every box after selecting it through keyboard. I don't unerstand how can I do the same with my character model.



  Also, I observed that the nodes that were created in JME from the milkshape model were the groups that were made in milkshape. Is it possible to control the 'joints' that are created in milkshape through JME ?



Thank you,



Pranav

HamsterOfDeath made a version of the milkshape skeletal controller which allows you to modify individual joints. You can find it on the forum by searching for milkshape control individual joints" or something like that.

my controller allows setting animation types and ranges per joint. if you just want to rotate them, just change the rotation of the jointmeshes. (i think)

Hi,

 

This is an attempt to let the user rotate each body part of a character imported from Milkshape. Anyone who has done something about this please let me know. I tried adding a controller to JointMesh in the MilkToJme.java file but had no success.



This is my modification of the readGroups() method


private void readGroups() throws IOException {
        int nNumGroups=inFile.readUnsignedShort();
        materialIndexes=new int[nNumGroups];
        for (int i=0;i<nNumGroups;i++){
            inFile.readByte();      // Ignore flags
            inFile.readFully(tempChar,0,32);    // Name
            int numTriLocal=inFile.readUnsignedShort();
            Vector3f[] meshVerts=new Vector3f[numTriLocal*3],meshNormals=new Vector3f[numTriLocal*3];
            Vector3f[] origVerts=new Vector3f[numTriLocal*3],origNormals=new Vector3f[numTriLocal*3];
            Vector2f[] meshTexCoords=new Vector2f[numTriLocal*3];
            int[] meshIndex=new int[numTriLocal*3];
            int[] jointIndex=new int[numTriLocal*3];
            JointMesh theMesh=new JointMesh(cutAtNull(tempChar));

            for (int j=0;j<numTriLocal;j++){
                int triIndex=inFile.readUnsignedShort();
                for (int k=0;k<3;k++){
                    meshVerts       [j*3+k]=myVerts[myTris[triIndex].vertIndicies[k]].vertex;
                    meshNormals     [j*3+k]=myTris[triIndex].vertNormals[k];
                    meshTexCoords   [j*3+k]=myTris[triIndex].vertTexCoords[k];
                    meshIndex       [j*3+k]=j*3+k;
                    origVerts       [j*3+k]=meshVerts[j*3+k];
                    origNormals     [j*3+k]=meshNormals[j*3+k];
                    jointIndex      [j*3+k]=myVerts[myTris[triIndex].vertIndicies[k]].boneID;
                }
            }
            theMesh.reconstruct(BufferUtils.createFloatBuffer(meshVerts),
                    BufferUtils.createFloatBuffer(meshNormals), null,
                    BufferUtils.createFloatBuffer(meshTexCoords),
                    BufferUtils.createIntBuffer(meshIndex));
            theMesh.originalNormal=origNormals;
            theMesh.originalVertex=origVerts;
            theMesh.jointIndex=jointIndex;
            finalNode.attachChild(theMesh);
            materialIndexes[i]=inFile.readByte();

            InputHandler input = new InputHandler();         //This is New
            KeyBindingManager keyboard = KeyBindingManager.getKeyBindingManager();   //This is New
            NodeHandler nc1;       //This is New
            Node selectedNode;    //This is New   
   
            nc1 = new NodeHandler(theMesh, 5, 1 );  //         This is New
            input.addToAttachedHandlers( nc1 );  //         This is New
            keyboard.set("node1", KeyInput.KEY_SPACE);       //         This is New
              InputAction buttonAction = new InputAction() {      //         This is New
            public void performAction( InputActionEvent evt ) {    //         This is New
                System.out.println( "button action performed" );     //         This is New
            }                                                                       //         This is New
        };
            input.addAction( buttonAction  , "node1", false );      //         This is New
            finalNode.updateRenderState();                               //         This is New
               
        }
   




Please let me know how can I make the controlling of joints through mouse possible.

Thank you

Pranav Bhalla

Hi Pranav,

Did you get any success on this??

I am looking for the same problem.



Abhishek