Crash on getPhysicSpace

I’m trying to load a spatial into my collision space but everytime I get a crash.


bulletAppState = new BulletAppState();

player = new BetterCharacterControl(1f,6f,1f);
player.setJumpForce(new Vector3f(0, 0, 0));
player.setGravity(new Vector3f(0, -10, 0));
player.warp(new Vector3f(0, 75, 0));
toon.setLocalTranslation(0, 75, 0);


The crash occurs on the last line when I’m adding the prison spatial. I can comment this line out and everything will load fine and I warp to (0,75,0) Then start falling through my environment because the prison isn’t added to the physics. Not sure if this helps.

at com.jme3.bullet.PhysicsSpace.add(
at mygame.prisonbreak.setupcollision(
at mygame.prisonbreak.initialize(
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(

you missed out on a bit of the stack trace (the exception). If it’s a NPE, did you check that prison is not null?

If by “crash” you mean an exception, it might be helpful to know the type of exception.

It might also be helpful to know which version of JME3 you’re running.

If it’s a NullPointerException in a recent ‘master’ build (not stable/3.0.9), then the source code (available from

suggests that the problem is a spatial which lacks a PhysicsControl.

Add a PhysicsControl to ‘prison’ and the crash should go away.

Thanks it seems I had to add a control to it. However the prison is a static object that doesn’t move and doesn’t need a control. Can you add just the geometry of the spatial to the physics space ? I tried to do that using the original collision tutorial code but with no success.

Controls serve many different purposes. They aren’t just for animation.

You could add shape (not the geometry) to physics space without creating a control, but that doesn’t gain you anything as far as I can see. Controls are cheap.