- Home /
The question is answered, right answer was accepted
Why don't you allow doubles and or long for Vector3 and Quaternion....?
this is the most frustrating thing to not be allowed to use doubles for this as float isn't up to the precision that i require. ,I think this is a major flaw with unity to not allow anything but floats for Vector3's at this point it makes me not want to use the game engine at all and see if unreal engine allows me to do it and if I find out it does i'm probably going to immediately switch to unreal.
floats have 32 bit precition. another words the accuracy of an objects position is approximatly 2,147,483,647 possibilitys across the moniter,. which is far far more acurracy than what could be displayed on a users screen witch is limited to 1080 parts/pixels for the screen). if you describe what you need this precition for or what you are not able to accomplish through unity. im sure someone here can answer your question if you are specific about your problem.
If you are not satisfied with the Unity's Vector and Quaternions, you can create your own custom structs with double
/ long
. But you will have to reimplement all the functions currently taking floats (including the $$anonymous$$athf
class)
Answer by MaximBesters · Jun 10, 2020 at 12:23 PM
Unreal also works with floats. I think the underlying engine (D3D / or opengl) use float too. Float is faster and Processor performance is often indicated in flops: (floating point operations per second) and that is what a cpu is optimized for.
Imagine a space scene with planets in a galaxy and houses on the planets. You would measure everything in meters (or feet, whatever) and the distance to the outer planets of your galaxy would be around 100,000,000,000,000,000,000 meters (units). Even a double only has 16 decimal places. (opposed to 7 or 8 in a float) That would make our sun look like a cube of one double precision unit in size. Also, the Unity scene view would be useless. You;d see an empty scene with tiny specs for solar systems even planets would be totally invisible.
You can use workarounds for this because you hardly really need double precision, actually. You could, for instance, have multiple camera's in different spaces. One camera for the total overview (everything will be smaller than one pixel, so not sure what you'd show here) Scale the whole galaxy down a billion times. No-one would notice. A camera for on the planet, or even a special camera for inside a city, With some clever math you can seamlessly integrate the blending of the camera. See where I am going? I hope this all makes any sense.
Follow this Question
Related Questions
How should I convert timestamp in unity, which is a double, in a webserver-like BIGINT number ? 5 Answers
Is iPhoneInput.lastLocation.timestamp broken on Android ? 2 Answers
How do I initialize a float texture by script? 1 Answer
Why this prints (0, 0, 0): Debug.Log("" + ((new Vector3(1, 0, 0)) * 0.016f)); 1 Answer
About character doublejumping. 1 Answer