Model Loads yet nullpointerexception

Hi all,

Still busy with the shooter. And again I cannot find an answer in the forum past or tutorials.

I use the following code to load my model:

private Node loadModel(String url){
        Node model = null;
        try {
           MaxToJme C1 = new MaxToJme();
           ByteArrayOutputStream BO = new ByteArrayOutputStream();
           URL maxFile = new URL(url);
           C1.convert(new BufferedInputStream(maxFile.openStream()),BO);
           model = (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
        } catch (IOException e) {
        return model;

This seems to work as the debugger shows it is loading the model, except that It cant find a particular image file but no problems there.

In the Ship class during the constructor phase:


And the chasecamera phase, this is where the nullpointer occurs:

private void buildChaseCamera() {
        Vector3f targetOffset = new Vector3f();
        targetOffset.y = ((BoundingBox) player.getWorldBound()).yExtent * 1.5f;


The error is in the second line: targetOffset.y = ((BoundingBox) player.getWorldBound()).yExtent * 1.5f;
SEVERE: Exception in game loop

What am I doing wrong? If, instead of the model, i produce a simple box it works fine, but a model doesnt.


I got it working, silly me:

Forgot to 

model.setModelBound(new BoundingBox());


However, now I get stuck in the planet I have with the textures of the planet,


you mean the ship, or another object has the texture of the planet right?

Mostl ikely you miss an rootNode.updateRenderState() after adding the ship or planet to the rootNode.