Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Why does Node positions in Webgl and android target....

just_in_case
Moderator
Quote
2017-10-03 17:38:26

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....


niko
Moderator
Quote
2017-10-06 08:09:08

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.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internation?l" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact