Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question How do I get around the floating point limit for unity?

Discussion in 'World Building' started by Richard_Ingalls, Feb 22, 2023.

  1. Richard_Ingalls

    Richard_Ingalls

    Joined:
    Dec 16, 2021
    Posts:
    77
    I need to have a large world, and I am planning on incorporating multiplayer into my game, so moving everything except the player won't work. The limit I've found is 100,000.00, but that only goes to 2 decimal places, and a 200,000 unit cube is too small. I could shrink the size of everything, but that would require more decimal places than 2, which means going back, which means we're back where we started. Does anyone know of a workaround for this?
     
  2. SF_FrankvHoof

    SF_FrankvHoof

    Joined:
    Apr 1, 2022
    Posts:
    780
    This isn't a limit in unity. It's a limit of floating point numbers in general.

    IEEE-754 Floating Point Converter (h-schmidt.net)
    Floating-point arithmetic - Wikipedia

    Have a look at KSP's Unite-Video: Unite 2013 - Building a new universe in Kerbal Space Program - YouTube
     
  3. Richard_Ingalls

    Richard_Ingalls

    Joined:
    Dec 16, 2021
    Posts:
    77
    Floating origin does not work, because I want to have multiplayer
     
  4. ShilohGames

    ShilohGames

    Joined:
    Mar 24, 2014
    Posts:
    2,956
    You can build a large open world multiplayer game using a floating origin. You may need to build your own custom networking solution to do it well, but it can definitely be done.
     
  5. Richard_Ingalls

    Richard_Ingalls

    Joined:
    Dec 16, 2021
    Posts:
    77
    How would I go about that?
     
  6. SF_FrankvHoof

    SF_FrankvHoof

    Joined:
    Apr 1, 2022
    Posts:
    780
    Have the client maintain its own Origin-TRSMatrix. Then do everything relative to that.
    There'll be some slight 'errors' but only on objects that are far away from the client's origin, so that shouldn't really matter.