I'm trying to accurately represent the Earths mass and relate that to a persons mass to calculate gravitational forces between the two bodies.
I have no issue if the earths mass is set programatically, or calculated. However, I can't seem to input it into the editor. The editor keeps changing the value to something lower, or reverting to my previous set mass on the RigidBody. I'm attempting to set them in the editor so I can place certain planets with specified weights.
Is there a restriction on the float values in the editor thats lesser than that which can be represented in C# scripts in Unity? Or am I going about this in the wrong way?
asked Oct 18 '10 at 01:47 PM
Perhaps you could compute the force of gravity in a script, using double-precision numbers (use "double" instead of "float"). Then set the computed gravity on the physics manager, or on the specific rigid bodies as needed. If you only need to do this once (like, when you land a new planet) that should suffice. If you need to do it constantly (like, for a spaceship flying near a planet) you could calculate it in Update(), or maybe in a coroutine that fires every few seconds if it isn't changing drastically.
answered Mar 08 '11 at 02:39 PM