Problems with MaxToJme Node and ChaseCamera

Hi,



firt of all i'd like to say that english is not my mother tongue, so excuse bad gramma or spelling :wink:



I'd like to give you a quick introduction to my project. I'm working on a game called JRobotArena where Player can fight with robots against each other. I've made several classes to realize this, e.g. the Robot which contains other Classes like Weapon or the Chassis.



The Robot Class forms a Node out of all the other Nodes provided by it's Components (Weapons, Chassis etc.). This RobotNode is added to the SceneNode or RootNode and a ChaseCamera.



The Robot has a method called buildRobot() called in the Constructor.


private void buildRobot() {       
        RobotNode.attachChild(RobotChassis.getNode());
        RobotNode.attachChild(RobotWaffe.getNode());
        RobotNode.setLocalTranslation(new Vector3f(100, 0, 100));       
        RobotNode.addController(new RobotController(this));
        RobotNode.updateWorldBound();
    }



The Class Chassis contains a methode called buildChassis() called by it's Constructor, too.

private void buildChassis(){
        Model = new Node();
        MaxToJme ChassisConverter = new MaxToJme();
        try {
            ByteArrayOutputStream BO = new ByteArrayOutputStream();
            URL maxFile = Chassis_1.class.getClassLoader().getResource("komponenten/chassis/models/Chassis_1.3ds");
            ChassisConverter.convert(new BufferedInputStream(maxFile.openStream()), BO);
            Model = (Node) BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));           
            Model.setLocalScale(0.01f);
            Model.setModelBound(new BoundingBox());
            Model.updateModelBound();
        } catch (IOException e) {}
        ChassisNode.attachChild(Model);
        ChassisNode.setModelBound(new BoundingBox());
        ChassisNode.updateModelBound();
    }



The Weapons Class looks basically the same. My main Class contains the method buildChaseCamera()

private void buildChaseCamera() {
        Vector3f targetOffset = new Vector3f();
        targetOffset.y = ((BoundingBox) Player.getRobot().getWorldBound()).yExtent * 1.5f;
        HashMap props = new HashMap();
        props.put(ThirdPersonMouseLook.PROP_MAXROLLOUT, "16");
        props.put(ThirdPersonMouseLook.PROP_MINROLLOUT, "3");
        props.put(ChaseCamera.PROP_TARGETOFFSET, targetOffset);
        props.put(ThirdPersonMouseLook.PROP_MAXASCENT, ""+90 * FastMath.DEG_TO_RAD);
        props.put(ChaseCamera.PROP_INITIALSPHERECOORDS, new Vector3f(5, 0, 30 * FastMath.DEG_TO_RAD));
        props.put(ChaseCamera.PROP_TARGETOFFSET, targetOffset);
        chaser = new ChaseCamera(cam, Player.getRobot(), props);
        chaser.setMaxDistance(8);
        chaser.setMinDistance(2);
    }



where Player is an instance of Robot and the getRobot() method will return the RobotNode.

Now when I'm starting my Game I'm getting the following errormessage:

SCHWERWIEGEND: Exception in game loop
java.lang.NullPointerException
        at jrobotarena.RobotMain.buildChaseCamera(RobotMain.java:150)
        at jrobotarena.RobotMain.initGame(RobotMain.java:121)
        at com.jme.app.BaseGame.start(BaseGame.java:74)
        at jrobotarena.RobotMain.main(RobotMain.java:51)
15.05.2009 07:21:10 com.jme.app.BaseGame start
INFO: Application ending.



But when i'm adding a Box or something similar to the RobotNode everything works well.
Where is the Problem?

I allready searched the forums and wiki, but found nothing :( Just a few threats but they didn't solved my problem.

So long ...

BaBene