- Home /
Vector3 constructor precision
I'm having a problem creating a Vector3 variable, starting with 2 other float variables. This is a snipped of code:
float indz = Mathf.Cos(alpha);
float indx = Mathf.Sin(alpha);
Vector3 ind = new Vector3(indx,0,indz);
the variables' value are:
indz = 0.999954
indx = 0.009595863
the resulting vector is:
ind = (0.0, 0.0, 1.0)
Why this? And how can I avoid this issue? I need that vector because I have to transform it in the coordinate system of another object, and I need it at the maximum precision. Thanks!
Comment
Best Answer
Answer by Eric5h5 · Jan 11, 2011 at 03:45 PM
It's not a precision problem...print out the individual axes (x/y/z) instead of the whole thing.
you're right! The issue is only with the toString method. Thanks!
Your answer
Follow this Question
Related Questions
Link a value to another value in the Inspector 1 Answer
CharacterController.Move precision 1 Answer
How Precise is Random.Range? 1 Answer
float precision, again 0 Answers