• 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
0
Question by z0code0z · Jul 15, 2020 at 04:03 AM · transform.positionfloatmaxgeneral programming

Is there a limit to how large a position value can go?

Current game has trash scale, It is beyond difficult to fix with the current models, so it travels about 1000 values of x in a matter of like 2 seconds

it works really well so i'm not too worried, but I've read elsewhere that its possible to reach some "max float" and that this can happen with endless runners

Can anyone provide any insight into this?

Thanks!

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
1

Answer by tuinal · Jul 15, 2020 at 04:55 AM

A float is a long number with a decimal point, so if it holds a very large number, it loses decimal places.

What this means in a practical sense is objects with a very large transform position have a correspondingly lower accuracy, and will start clipping into each other and z-fighting.

I think Unity performs a translation from world to camera space before rendering to help avoid this, but that won't magically create the missing decimals.

I would try changing the import scale down on the models; it may be time-consuming but the other drawback of very large units is a lot of systems assume 1 unit = 1 metre, and you'll likely run into issues with physics & animation down the road which whilst fixable mean you end up writing scripts designed to work with crazy scales, and which thus aren't transferable/reusable. A lazy fix is to put your environment as a child of a single gameobject and set it's scale to the inverse (e.g. 0.001).

Comment
Add comment · Show 1 · 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 z0code0z · Jul 15, 2020 at 05:24 AM 0
Share

Yea, I ended up fixing all the physics (It actually made it nicer and arcadey feeling -- which is what I was going for)

Do you perhaps know how long until that would happen? I might consider just redoing the scales for everything and redoing the current physics if it means that much but if it would take A LONG time for the player to get to that point, I'm alright with it, the objects spawned that require "precision" or would matter if they clipped are spread apart by 10m (through script) so if i understood correctly, they wouldn't clip and therefore everything should be good?

Thanks for the response, this topics kinda funky for me and I'm trying to determine if its truly worth it to switch everything!

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

131 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What is the max float? -1 Answers

Use Another Float Value As Range Attribute's Max Value 1 Answer

Separating smoothDampTime into separate axis 0 Answers

SmoothDamp to character controller.moveto 0 Answers

hello there I am Trying to Instantiate a 1 of 5 GameObjects 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges