Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Why does the position of Scenenodes in Webgl and android target are slightly changed...they are not accurate... i have an action attached to my node execute javascript in which ... for example if the scenenode's position is equal to the given position say (-70, 1.15, 70) then change the position of scene node to something else say (120, 1.15, -120)...else change the Position to (0,0,0) this is working fine in windows target... But for Android and Webgl... condition never gets fullfilled... to debug the problem.... i draw the position of the scenenode on a 2d overlay on every 1000 Ms.. and i found that its shows position as (-70,1.15,70) Accurate positions on windows target... but when i tested the Same project on webgl target it shows me position (-70,1.14999.....,70) which means on webgl target the condition can never gets fullfilled.. as the position after the decimal is not accurate... don't know why this happens.... |
||||
|
That's a floating point problem. This happens, you just have to live with it: Calculations in floating point space are never that exact. For checking a position, you usually don't check if x == 12.0 but better x > 11.999 && x < 12.001 for example. The windows target uses a bit higher floating point precision, so you won't see it that often or early. |
|