I want to use a model collada or another
But whenever I Export even a cube
Jme begins instructed then crash
I made a lot of tries and I always the same thingI also imported Skin Man in the blender and also in
ColladaLoader first is not open and 2 nd crash
However the code works very well with man.dae
There is the parameter or structure to comply on file collada that we charge with jme?
is just a copy of TestColladaLoading Without skelet
package jmetest.renderer.loader;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.logging.Logger;
import com.jme.animation.AnimationController;
import com.jme.animation.Bone;
import com.jme.animation.BoneAnimation;
import com.jme.animation.SkinNode;
import com.jme.app.AbstractGame;
import com.jme.app.SimpleGame;
import com.jme.input.FirstPersonHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.light.PointLight;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Controller;
import com.jme.util.BoneDebugger;
import com.jme.util.resource.ResourceLocatorTool;
import com.jme.util.resource.SimpleResourceLocator;
import com.jmex.model.collada.ColladaImporter;
/**
* Shows how to load a COLLADA file and apply an animation to it.
* @author Mark Powell
*
*/
public class TestColladaLoading extends SimpleGame {
private static final Logger logger = Logger
.getLogger(TestColladaLoading.class.getName());
AnimationController ac;
boolean boneOn = false;
public static void main(String[] args) {
TestColladaLoading app = new TestColladaLoading();
app.setDialogBehaviour(AbstractGame.ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
protected void simpleUpdate() {
if( KeyBindingManager.getKeyBindingManager().isValidCommand( "bones", false ) ) {
boneOn = !boneOn;
}
}
protected void simpleRender() {
//If we want to display the skeleton use the BoneDebugger.
if(boneOn) {
BoneDebugger.drawBones(rootNode, display.getRenderer(), true);
}
}
protected void simpleInitGame() {
try {
ResourceLocatorTool.addResourceLocator(
ResourceLocatorTool.TYPE_TEXTURE,
new SimpleResourceLocator(TestColladaLoading.class
.getClassLoader().getResource(
"jmetest/data/model/collada/")));
} catch (URISyntaxException e1) {
logger.warning("Unable to add texture directory to RLT: "
+ e1.toString());
}
KeyBindingManager.getKeyBindingManager().set( "bones", KeyInput.KEY_SPACE );
//Our model is Z up so orient the camera properly.
cam.setAxes(new Vector3f(-1,0,0), new Vector3f(0,0,1), new Vector3f(0,1,0));
cam.setLocation(new Vector3f(0,-100,20));
input = new FirstPersonHandler( cam, 80,
1 );
//this stream points to the model itself.
InputStream mobboss = TestColladaLoading.class.getClassLoader()
.getResourceAsStream("jmetest/data/model/collada/man.dae");
if (mobboss == null) {
logger.info("Unable to find file, did you include jme-test.jar in classpath?");
System.exit(0);
}
//tell the importer to load the mob boss
ColladaImporter.load(mobboss, "kl");
SkinNode sn = ColladaImporter.getSkinNode(ColladaImporter.getSkinNodeNames().get(0));
//clean up the importer as we are about to use it again.
ColladaImporter.cleanUp();
rootNode.attachChild(sn);
rootNode.updateGeometricState(0, true);
//all done clean up.
ColladaImporter.cleanUp();
lightState.detachAll();
PointLight pl = new PointLight();
pl.setAmbient(new ColorRGBA(0.5f,0.5f,0.5f,1));
pl.setDiffuse(new ColorRGBA(1,1,1,1));
pl.setLocation(new Vector3f(10,-50,20));
pl.setEnabled(true);
lightState.attach(pl);
}
}
at this line :SkinNode sn = ColladaImporter.getSkinNode(ColladaImporter.getSkinNodeNames().get(0));
console :
java.lang.NullPointerException
at jmetest.renderer.loader.TestColladaLoading.simpleInitGame(TestColladaLoading.java:93)
at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:503)
at com.jme.app.BaseGame.start(BaseGame.java:69)
at jmetest.renderer.loader.TestColladaLoading.main(TestColladaLoading.java:40)