Search Unity

[Windows Phone] Props flickering when the game is far from the origin

Discussion in 'Windows' started by sentendo, Nov 28, 2014.

  1. sentendo

    sentendo

    Joined:
    Sep 23, 2014
    Posts:
    49
    Hi all,
    I am experiencing serious issues when the game is far from the origin (0,0,0) of Unity3D.
    I am working at an endless runner and the track builds dinamically in the "z". The car I have moves mostly on the "z" axis and when I am more than 600 unities far from the 0 I see some prop which funds with some other one, and stuff like that. The problem is getting more worrysome when I am at more than 5000.
    Can I do anything to solve that?
     
  2. sentendo

    sentendo

    Joined:
    Sep 23, 2014
    Posts:
    49
    any hint about that?
     
  3. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Is this a windows phone specific problem? i.e. generally once the coordinates go into "thousands" range, you'll start seeing problems across the board (physics, collision, rendering etc.) due to limited floating point precision. So I guess the same happens in the editor too?

    Otherwise, usual tricks apply. For Z buffer precision, increase camera's near plane as high as possible.

    For "large coordinates" problem, some people solve that by "shifting" whole world towards the origin once the coordinates go past some range.
     
  4. sentendo

    sentendo

    Joined:
    Sep 23, 2014
    Posts:
    49
    I have the same problem in the Editor, not only Windows Phone.
    And the problem starts at 600 far from z, more or less.
     
  5. sentendo

    sentendo

    Joined:
    Sep 23, 2014
    Posts:
    49
    so, playing with near and far plane I partly solved the problem.
    Now the problem is that when I am almost 10k far from the 0 some geometry starts to disappear. I don't know if could be a memory issue.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    As Aras mentioned, this is a floating-point precision issue. Floats get pretty inaccurate once you go into thousands.