Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by RSud · Aug 16, 2010 at 03:35 PM · 3dcoordinatesbounds

Unity 3D world space coordinate bounds?

What is the minimum/maximum x,y,z values that can be used for unity 3d coordinate system?

In a 3d space game I want to know when a object will fly past (exceed) the maximum coordinate that unity can support?

I am consider a multi-star system game. In order to accomodate stars seperated by large space that then have planets around them also seperated by large space and then small space ships flying around I want to know how much "territory" I have to work with.

Thanks for help!

Comment
Add comment
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

1 Reply

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

Answer by Wolfram · Aug 16, 2010 at 03:46 PM

You need to be very careful about choosing an appropriate scale for your star systems. Unity as a game engine uses only single-precision 'float', so you are very limited in what you can do.

'float' can distinguish only around 7 digits, so it will already have a very hard time distinguishing between 1000000.0 and 1000001.0, small motion will become very jerky, or not recognized at all, etc.

The overall scale that floats can handle goest to about 1e38 - but you don't want to use numbers that large, since you will run into several problems at various points in the engine - starting with camera clipping planes, etc, not to mention the physics simulation algorithms.

You probably need to think about other solutions, like adaptively changing the scale depending on whether you are around a planet, in interplanetary space, or in interstellar space. Or making actual scene switches when switching between interstellar view and orbit view etc. Or simply use smaller scale differences - forget about "realistic" scales, like trying to represent a 2 meter human in a spaceship orbiting a 1.2e7 meter planet at a distance of 1.5e11 meter of its star (these are realitic numbers for Earth+Sun, for example) - it just won't work, even with double precision floats.

EDIT: one more thing, because of the precision limits, any computation will get more imprecise, as you move more and more away from the origin (0/0/0), so you should try to keep your camera and/or player/point-of-interest always around the origin, instead of letting it travel to vast distances. It might be better to move the stars/planets around and keep the player fixed, instead of the other way round. Test this for yourself: create a unity cube, place it at (100000/0/0), and press 'f' in the SceneView to zoom to the cube. When you now move the scene view around the cube you's see it is getting very jerky, and the rendering of the collider does no longer match the cube faces at all times.

Comment
Add comment · Show 5 · 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 Aubrey Hesselgren · Aug 16, 2010 at 05:16 PM 1
Share

The Edit you've given is how I was thinking about it, but I also thought of another (perhaps weirder) solution.

Chunk the world into cubes. When the camera passes across a cube boundary, increment your 3D cube index so that you can keep a track of base "universe space".

Everything inside a cube is within a more reasonable floating point range, i.e. -100.0f..100.0f for X Y and Z.

This might reduce the amount of repositioning overhead you'd have to do - you would only have to reposition objects relative to the player when passing over the cube boundaries. It might be slightly more efficient.

avatar image Wolfram · Aug 16, 2010 at 05:50 PM 0
Share

That sounds like a smarter approach to my suggestion of "making actual scene switches", i.e., distributing these space sectors in different Unity scenes - but maybe one doesn't want to switch scenes all the time. Although this could be nicely combined with some kind of "entering hyperspace" cutscene animation. With your idea, you'd have everything together, you just need to take care of what your camera sees "beyond" such a cube, and where the "unused" cubes are placed so that the camera doesn't see them (which is easy: beyond the far clipping plane).

avatar image RSud · Aug 17, 2010 at 02:25 PM 0
Share

Some great info and suggestions. Particularly the move everything else rather than the player gameobject. Thanks!

avatar image Snownebula · Aug 18, 2014 at 11:23 PM 0
Share

I am currently build a space game and I have to say I am finding the limits a lot closer than that. I am getting limits around 200k.

avatar image Bunny83 · Aug 18, 2014 at 11:45 PM 1
Share

@Snownebula: $$anonymous$$aybe you didn't really understand that answer. There are no actual limits. As soon as the position is greater than 1.0 or smaller than -1.0 you will loose precision. It's a floating point number. What precision is "enough" depends on your scale.

A floating point number is stored as a binary number. Whenever your number before the decimal point requires 1 bit more, you will loose one at the other end. That's what the "floating point" actually does.

For space games it's most the time necessary to "chunk" your world. Aubrey Hesselgren's solution is the most common one i would say.

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

2 People are following this question.

avatar image avatar image

Related Questions

My ingame avatar's worldspace does not coincide with other objects 1 Answer

getting screen coordinates for 3d object? 1 Answer

How to get local coordinates from a game object? 0 Answers

Collider.bounds position is wrong? 3 Answers

Getting other cameras coordinates 1 Answer


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