NullPointerException in BIHTree

Hi guys,

[java]SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]


at com.jme3.collision.bih.BIHTree.<init>(

at com.jme3.collision.bih.BIHTree.<init>(

at com.jme3.scene.Mesh.createCollisionData(

at com.jme3.scene.Mesh.collideWith(

at com.jme3.scene.Geometry.collideWith(

at com.jme3.scene.Node.collideWith(

at com.jme3.scene.Node.collideWith(

at com.jme3.scene.Node.collideWith(

at com.jme3.scene.Node.collideWith(

at com.jme3.scene.Node.collideWith(

at net.herodex.client.framework.state.ClickableState.findClickableAtCursor(

at net.herodex.client.framework.state.ClickableState.access$000(

at net.herodex.client.framework.state.ClickableState$1.onAction(

at com.jme3.input.InputManager.invokeActions(

at com.jme3.input.InputManager.onMouseButtonEventQueued(

at com.jme3.input.InputManager.processQueue(

at com.jme3.input.InputManager.update(



at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(




I’m (very) occasionally getting this exception, I don’t really have a reproduction case yet…it just seems to happen at some point during a match.

I don’t know if this is relevant (sample size too small) but the video recorder app state has been running whenever it has happened.

Any idea what could cause this?

Code in question is:


private Clickable findClickableAtCursor() {

InputManager inputManager = AppContext.getJme3().getInputManager();

Camera cam = AppContext.getJme3().getCamera();

// Reset results list.

CollisionResults results = new CollisionResults();

// Convert screen click to 3d position

Vector2f click2d = inputManager.getCursorPosition();

Vector3f click3d = cam.getWorldCoordinates(click2d, 0f).clone();

Vector3f dir = cam.getWorldCoordinates(click2d, 1f).subtractLocal(click3d).normalizeLocal();

// Aim the ray from the clicked spot forwards.

Ray ray = new Ray(click3d, dir);

// Collect intersections between ray and all nodes in results list.

AppContext.getJme3().getRootNode().collideWith(ray, results);


The last line in that code block is at net.herodex.client.framework.state.ClickableState.findClickableAtCursor(




It seems like you have an invalid mesh somewhere in the scene graph (a Mesh without a position VertexBuffer)

Hmm, interesting. I do have some dynamically generated meshes and this crash happens at around the time they are doing their thing. Maybe one of those has an empty buffer for a while.

It’s a lead anyway. I’ve put a try/catch on an exception and a breakpoint in the catch. Next time it happens I’ll be able to do some poking around so that’s the first place I’ll look.

Sorry for bumbing this thread but I also have that problem now (same exception) with the only difference, that it always happens.
Have you found out anything about that behaviour?

Yes, it happens if you have a completely empty mesh (0 vertices) and try to collide with it.

I did put a work around in recently but haven’t been able to test it properly for various reasons.

1 Like

Haha Yay!
Thank you very much, I could solve the problem with that information.
Aaaaand the motivation is back :slight_smile: