Search Unity

Extremely Odd Unity Bug?!

Discussion in 'Editor & General Support' started by DevS0L0, Oct 15, 2018.

  1. DevS0L0

    DevS0L0

    Joined:
    Feb 10, 2017
    Posts:
    12
    I'm having a major issue that scripting cannot fix. My map is very large (50000X50000) and the more my player or even objects gets away from the center pivot (0,0,0), he/objects begins to violently shake more and more and more to the point that it's extremely noticeable. I have no idea why Unity does this and I cannot find any way to fix it except for one which would require my map to be extremely small, which is impossible for my type of game. If I can't fix this I'm going to have to move to Unreal, because this bug is completely game breaking. Any help will be greatly appreciated!

    Some information
    - Terrain size is 50000X50000
    - Once my player or objects are far away from the pivot on the X,Z scale, it beings to shake extremely bad (Only occurs when there is a position or rotation change of any value)
    - This is present even inside the Unity animator, making animating objects at their relative world position impossible
    - My Terrain is also shaking when i look at it closely (Stops after 10 seconds of not rotating the camera)
    - The second my camera has ZERO movement, all the shaking stops until I move the camera again (Any rotation value will start the shaking, and it's far from 0,0,0 position)
    - There is no shaking when my player/objects are at 0,0,0
    - If I set the transform Z value to lets say 40000, very noticeable distortion on the object appears once it is moving/rotating in any way. If i do the same for the Y axis, it is much more worse and full on distortion appears.

    What I've tried
    - Scaling the glitching objects
    - Placing the objects with very high Transform values inside a empty game object with position 0,0,0
    - Camera scripts
    - Rendering
    - Different scene
    - Different project (My character and terrain imported obviously)
    - A million different Unity answers solutions
     
    Last edited: Oct 15, 2018
  2. It's not a bug per say. It's not unique to Unity. It's about floating point imprecision. Look it up, even on the internet, there are limitless sources.
    The solution for it is Floating Origin. Basically you're shifting your content alongside with the player(s) to the origin from time to time in order to not exceed certain limit in coordinates.

    A little more info and discussion about it:
    https://forum.unity.com/threads/floating-point-errors-and-large-scale-worlds.526807/
     
    DevS0L0 likes this.
  3. DevS0L0

    DevS0L0

    Joined:
    Feb 10, 2017
    Posts:
    12
    I looked into this and solved the issue, thanks!