Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Lord Simpson · Mar 27, 2011 at 06:56 PM · vector3precisiondouble-float

Any solution For extreamly large gameworlds [Single Precision Problem]

In my Game I require a working space of preferably around a few hundred Km. Looking at previous Questions the answers given are usually either Scale down the scene or use some form of spacial partitioning [breaking down the space into smaller chunks].

At standard scale under 10,000 is mostly jitter free

Unless I'm doing something wrong scaling down the scene doesn't seam to fix anything as if I scale down everything by 100, the "jitter point" just appears 100 times closer so I'm stuck with the same overall world size.

If I go the spacial partitioning route and assuming and I don't have the chunks overlapping [which would make the transitions smoother] increasing the size of the scene cubes for each extra layer 10,000 = 1, 50,000 = 27 , 90,000 = 125 chunks which is an insane number of chunks for the size I require.

Assuming there is a way to convert the Vector3's to double precision floats I would have an insane workspace before the "jitter point" appears [~30au or the distance from the sun to Neptune!!]

SO is there any way to use double precision vector3's or some method I haven't found to allow unity to create Scenes the size I require

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image · Mar 27, 2011 at 07:29 PM 3
Share

I've read one solution - though not sure where - to have the scene move around the camera, which remains near the origin. If you think this is a possibility for your project, it might be worth having a search around. (Scotty: Imagine that! It never occurred to me to think of SPACE as the thing that was moving!)

avatar image Lord Simpson · Mar 28, 2011 at 10:37 AM 0
Share

Thanks for the idea, I've Come up with a solution based on it below.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Lord Simpson · Mar 28, 2011 at 10:31 AM

Ok ive come up with the following Idea, Any comments / improvements are welcome

    if (check) {
        float dist = Vector3.Distance (transform.position, Vector3.zero);
        if ( dist > 8000f) {
            foreach (GameObject obj in Object.FindObjectsOfType (typeof(GameObject)))                   
                if (obj != gameObject && obj.transform.root != transform.root && obj.layer != 10 && obj.transform == obj.transform.root)                    
                    obj.transform.position -= transform.position;
            transform.position = Vector3.zero;
        }
        checkpoint = ((8000f - dist) / 600f);
        timer = 0;
        if (checkpoint > 0.5f)
            check = false;
    } else {
        if (timer > checkpoint) {
            check = true;
        }
    }
    timer += Time.deltaTime;

Basically it moves the entire world bar anything that is part of the game object this is attached to or anything on layer 10 which I have called "GlobalPosition" but only does this when the player is half a second from the 8km border at top speed.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lord Simpson · Mar 28, 2011 at 10:39 AM 0
Share

Also this seams to have good performance, my pc can cope with ~1024 "rigid cubes" with no noticeable hiccup when travelling over the border

avatar image Lord Simpson · Mar 30, 2011 at 01:44 PM 0
Share

Just Updated The code, basically had to add "&& obj.transform == obj.transform.root" to the check or it would move all the children of objects massively out of alignment

avatar image Joshua · May 15, 2011 at 04:17 PM 0
Share

Nice solution!!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

CharacterController.Move precision 1 Answer

Vector3 == comparison efficiency and float precision 5 Answers

Losing float precision when adding to Vector3 1 Answer

Precision problem when moving Rect values 2 Answers

Vector3 using Doubles Instead of Floats 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges