Collision problem

Hey guys,



don’t know why but for some time i get the following exception if i try to hover a node which is in the scene graph.



[java]Exception in thread “LWJGL Renderer Thread” java.lang.ArithmeticException: This matrix cannot be inverted

at com.jme3.math.Matrix4f.invert(Matrix4f.java:1220)

at com.jme3.math.Matrix4f.invert(Matrix4f.java:1194)

at com.jme3.collision.bih.BIHNode.intersectWhere(BIHNode.java:310)

at com.jme3.collision.bih.BIHTree.collideWithRay(BIHTree.java:420)

at com.jme3.collision.bih.BIHTree.collideWith(BIHTree.java:474)

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

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

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

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

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

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

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

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

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

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

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

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

at core.jme3.pick.PickManager.getCollision(PickManager.java:179)

at core.jme3.pick.PickManager.onMouseMotionEvent(PickManager.java:129)

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

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

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

at core.jme3.CityApplication.update(CityApplication.java:440)

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

at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:225)

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

at java.lang.Thread.run(Thread.java:662)[/java]



I implemented a simple pick management in which the collisions are detected.



[java]private Geometry getCollision(final Vector2f pMousePos) {

Vector3f location = camera.getWorldCoordinates(pMousePos, 0);

Vector3f direction = camera.getWorldCoordinates(pMousePos, 1);

Ray mouseRay = new Ray(location, direction.subtractLocal(location));

collisionResults.clear();

if (collisionNode.collideWith(mouseRay, collisionResults) > 0) {

return collisionResults.getClosestCollision().getGeometry();

} else {

return null;

}

}[/java]



Any idea what could cause the problem?



EDIT: It seems that the problem only occurs if the height of a box is to small.



Regards

Moe

Probably because the box is way too small