Hi, everyboy I'm trying to create a "Hello MD5 animation Example application" using the MD5 Importer concurrent version but the model is not moving, i like the "MD5 Reader old version" but this project is dead so i have to migrate to JME2 and use MD5 Importer, so one of my problems is that i don't understand very well how MD5 Importer works :(, so a good code will help me. here is my code, thank's :D:
import com.jme.app.SimpleGame;
import com.jme.scene.Spatial;
import com.jme.scene.state.BlendState;
import com.md5importer.MD5Importer;
import com.md5importer.control.MD5AnimController;
import com.md5importer.control.MD5NodeController;
import com.md5importer.interfaces.model.IMD5Anim;
import com.md5importer.interfaces.model.IMD5Node;
import java.io.IOException;
import java.net.URL;
public class Lesson1 extends SimpleGame {
public MD5Importer importer;
public IMD5Node modelMesh;
public IMD5Anim animation;
public MD5AnimController animController;
public MD5NodeController nodeController;
/**
* Main method is the entry point for this lesson. It creates a
* SimpleGame and tells the dialog to always appear. It then
* starts the main loop.
* @param args
*/
public static void main(String[] args) {
Lesson1 app = new Lesson1();
app.setConfigShowMode(ConfigShowMode.AlwaysShow);
app.start();
}
protected void simpleInitGame() {
importer = new MD5Importer();
//Load the MD5 model
URL urlMesh = this.getClass().getClassLoader().getResource("modelos/walkcycle_5.md5mesh");
URL urlAnim = this.getClass().getClassLoader().getResource("modelos/walkcycle_5_walk.md5anim");
try {
this.modelMesh = this.importer.loadMesh(urlMesh, "Mesh0");
this.importer.cleanup();
this.animation = this.importer.loadAnim(urlAnim, "Anim0");
this.importer.cleanup();
} catch (IOException ex) {
System.out.println("Error:"+ex.getMessage());
}
this.animController = new MD5AnimController(animation);
this.animController.setActive(true);
this.nodeController = new MD5NodeController(modelMesh);
this.nodeController.setActive(true);
this.nodeController.setActiveAnim(animController.getAnim());
//Triying to solve the problem using this lines
this.animController.update(tpf);
this.animController.update(tpf);
BlendState blend = this.display.getRenderer().createBlendState();
blend.setBlendEnabled(true);
blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
blend.setTestEnabled(true);
blend.setTestFunction(BlendState.TestFunction.GreaterThan);
blend.setEnabled(true);
((Spatial)this.modelMesh).setRenderState(blend);
// Attach to root node.
this.rootNode.attachChild((Spatial)this.modelMesh);
}
}