NullPointerException in BIHTree

Hi guys,



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

java.lang.NullPointerException

at com.jme3.collision.bih.BIHTree.<init>(BIHTree.java:117)

at com.jme3.collision.bih.BIHTree.<init>(BIHTree.java:130)

at com.jme3.scene.Mesh.createCollisionData(Mesh.java:837)

at com.jme3.scene.Mesh.collideWith(Mesh.java:853)

at com.jme3.scene.Geometry.collideWith(Geometry.java:454)

at com.jme3.scene.Node.collideWith(Node.java:493)

at com.jme3.scene.Node.collideWith(Node.java:493)

at com.jme3.scene.Node.collideWith(Node.java:493)

at com.jme3.scene.Node.collideWith(Node.java:493)

at com.jme3.scene.Node.collideWith(Node.java:493)

at net.herodex.client.framework.state.ClickableState.findClickableAtCursor(ClickableState.java:95)

at net.herodex.client.framework.state.ClickableState.access$000(ClickableState.java:32)

at net.herodex.client.framework.state.ClickableState$1.onAction(ClickableState.java:128)

at com.jme3.input.InputManager.invokeActions(InputManager.java:169)

at com.jme3.input.InputManager.onMouseButtonEventQueued(InputManager.java:433)

at com.jme3.input.InputManager.processQueue(InputManager.java:835)

at com.jme3.input.InputManager.update(InputManager.java:885)

at com.jme3.app.Application.update(Application.java:606)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:230)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)

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

[/java]



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:

[java]

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);

[/java]

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



Thanks,

Z

2 Likes

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.

Hi.
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?
Thanks

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!
:affe:
Thank you very much, I could solve the problem with that information.
Aaaaand the motivation is back :slight_smile: