Hi,
I've got a problem with the Chase Camera. My code is based on a modified version of the FlagRush tutorial.
It gives a null-pointer exception, but I can't find where it goes wrong. Where/how must I search where the error is. This is the code:
protected void update(float interpolation) {
// update the time to get the framerate
timer.update();
interpolation = timer.getTimePerFrame();
//update the keyboard input (move the player around)
input.update(interpolation);
//update the chase camera to handle the player moving around.
chaseCam.update(interpolation);
//we want to keep the skybox around our eyes, so move it with
//the camera
// skybox.setLocalTranslation(cam.getLocation());
// if escape was pressed, we exit
if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit")) {
finished = true;
}
//Because we are changing the scene (moving the skybox and player) we need to update
//the graph.
scene.updateGeometricState(interpolation, true);
}
This is the error from the log:
21-jun-2006 21:51:55 com.jme.scene.Node attachChild
INFO: Child (null) attached to this node (Scene graph node)
java.lang.NullPointerException
at com.jme.math.Vector3f.set(Unknown Source)
at com.jme.input.ChaseCamera.update(Unknown Source)
at VGS.SnowboardGame.SnowboardGame.update(SnowboardGame.java:98)
at com.jme.app.BaseGame.start(Unknown Source)
at VGS.SnowboardGame.SnowboardGame.main(SnowboardGame.java:88)
21-jun-2006 21:54:34 com.jme.app.BaseGame start
INFO: Application ending.
debug:
BUILD SUCCESSFUL (total time: 2 minutes 52 seconds)
Thanks in advance,
Jeroen
suplying a valid camera and target spatial to the chasecam?