More precise Vector3

Hey guys... I made a bullet gravity and wind effect with raycast... but the Vector3 use just 1 case before 0, giving a squared result... My script is working fine, but i need more Precise Vector3.... E.G. the unity is doing this:

100/27 = 3.7

but i need a more precise value:

100/27 = 3.7037 (more approximated value)

how can i "change" the Vector3 accuracy?

2 Answers

2

No, you don’t have to print out x, y, and z separately. There is an overload of Vector3.ToString that takes a “format” parameter. This is a C# Standard Numeric Format String. So, for example, to print your vector with 4 digits after the decimal place, just use

 someVec.ToString("F4").

Vector3 uses 3 single-precision floats, which can't be changed. Presumably you're looking at the output from Debug.Log(myVector3Variable), which is truncated for readability. If you want the "real" thing, print out x, y, and z separately.