Friday 15 March 2013

Java Double and Float math behaving unexpectedly -


I really need to be simple calculations for really getting weird output, I move a camera easily on the basis of delta I'm trying to see if you see camera-menu animation below, xMove and cameraDT times and the camera will be added to POSX. Camera PosX spits out again 1.7832639 E11 this makes no sense?? Cameraposi does the same thing.

  Private Double Chaucamametime, OldCameraTime, CameraFrameTime, CameraDT; Float camera posen = 1.0 f; Float camera POSY = 1.0f; XMove = .125f; YMove = .125F; Private Zero camera menu animation () {cameraPosX + = (xMove * cameraDT); CameraPC + = (yMove * cameraDT); Game CameraAssetCamRapos (CameraPoxX, CameraPossy); System.out.println ("xMove:" + xMove + "cameraDT:" + Camera DT + "Camera PosX:" + cameraPosX); } @ Override Public Wide Update () {// There are some accumulative variables here that I extracted (accumulator & gt; = steps) {currentCameraTime = System.currentTimeMillis (); Cameraframe time = current camerafile - old cameratime; CameraDT = cameraFrameTime; CameraMenuAnimation (); OldCameraTime = Current Camera Time; Accumulator - = steps; }  

This prints it from the println statement above it. It does not understand at all.

System.out (8714): xMove: 0.125 Camera DT: 31.0 Camera Pax: 1.7832639 E11

No comments:

Post a Comment