Collision help

I am trying to make collisions for my terrain node, however it gives me the error:



SEVERE Application 8:56:42 PM Uncaught exception thrown in Thread[Thread-7,5,main]

java.lang.NullPointerException

at com.veenen.Main.run(Main.java:625)

at java.lang.Thread.run(Thread.java:680)

Apr 15, 2011 8:56:42 PM com.jme3.app.Application handleError



heres the place where it is happening.



[java]sceneShape =

CollisionShapeFactory.createMeshShape(terrain);

landscape = new RigidBodyControl(sceneShape, 0);

sceneModel.addControl(landscape);[/java]

The nullpointer is in your own code.

normen said:
The nullpointer is in your own code.

Yes, but I'm wondering if I'm doing this correctly. Is what goes in the parameters for CollisionShapeFactory.createMeshShape(); supposed to be a node?

Oh, nevermind I got it.



[java]sceneModel = terrain;

sceneShape =

CollisionShapeFactory.createMeshShape(sceneModel);

landscape = new RigidBodyControl(sceneShape, 0);

sceneModel.addControl(landscape);



rootNode.attachChild(sceneModel);



bulletAppState.getPhysicsSpace().add(sceneModel);[/java]