AbstractCamera.getWorldCoordinates throws ArithmeticException

Hello,



Im trying to find the world coordinates of a pixel at x = middle, y = the bottom of the screen. However when I can camera.getWorldCoordinates(), it throws an ArithmeticException. The strangest part is… this method has worked a couple of times and then it stopped working. Also I am able to see a frame or two before the program goes down crashing.

Maybe there are some conditions involved when calling getWorldCoordinates(), otherwise this must be a bug.



I have search this forum but havent found any related bugs. However I havent entered it into the issue tracking system.



My specs: Ubuntu Linux (Feisty) with latest NVidia drivers, Java Sun 6, Jme from CVS.



java.lang.ArithmeticException: This matrix cannot be inverted

at com.jme.math.Matrix4f.invert(Matrix4f.java:1074)

at com.jme.renderer.AbstractCamera.getWorldCoordinates(AbstractCamera.java:953)

// not releavant trace, appended for completeness…

at org.lex.game.input.StrategicHandler.getViewBottomMid(StrategicHandler.java:204)

at org.lex.game.Demo.simpleUpdate(Demo.java:182)

at org.lex.game.MySimpleGame.update(MySimpleGame.java:70)

at com.jme.app.BaseGame.start(BaseGame.java:77)

at org.lex.game.Demo.main(Demo.java:68)

Ok… it must be late and Im tired  :oops:



After some more testing i found that some strange bug in my camera update method keeps moving the camera up, so I guess at some point float arithmetics has an exceedingly large error, which is detected and thrown as an ArithmeticException.



Oh well, maybe if someone else stumbles on the same exception they will be able to figure it out faster than i did.



Here is a printout of the result of calling getWorldCoordinates()…

com.jme.math.Vector3f [X=0.0, Y=-1.0, Z=-1.0]

com.jme.math.Vector3f [X=0.0, Y=124.17115, Z=-0.10556908]

com.jme.math.Vector3f [X=0.0, Y=371.34192, Z=-0.60515213]

com.jme.math.Vector3f [X=0.0, Y=865.6833, Z=-1.1043253]

com.jme.math.Vector3f [X=0.0, Y=1854.3662, Z=-1.6037158]

com.jme.math.Vector3f [X=0.0, Y=3831.732, Z=-2.1033525]

com.jme.math.Vector3f [X=0.0, Y=7786.463, Z=-2.6030657]

com.jme.math.Vector3f [X=0.0, Y=15695.926, Z=-3.1030488]

com.jme.math.Vector3f [X=0.0, Y=31514.852, Z=-3.6024501]

com.jme.math.Vector3f [X=0.0, Y=63152.707, Z=-4.101893]

com.jme.math.Vector3f [X=0.0, Y=126428.414, Z=-4.601361]

com.jme.math.Vector3f [X=0.0, Y=252979.83, Z=-5.1008425]

com.jme.math.Vector3f [X=0.0, Y=506082.66, Z=-5.6003327]

com.jme.math.Vector3f [X=0.0, Y=1012288.3, Z=-6.0998273]

com.jme.math.Vector3f [X=0.0, Y=2024699.8, Z=-6.557699]

com.jme.math.Vector3f [X=0.0, Y=4049522.5, Z=-7.057198]

com.jme.math.Vector3f [X=0.0, Y=8099168.5, Z=-7.5566974]

com.jme.math.Vector3f [X=0.0, Y=1.6198459E7, Z=-8.222696]

com.jme.math.Vector3f [X=0.0, Y=3.239704E7, Z=-8.888696]