I am using in Unity the function
Quaternion.LookRotation(normal, (0,1,0));
The docs you can find here https://docs.unity3d.com/ScriptReference/Quaternion.LookRotation.html. This should be a problem, if the normal is parallel to the y-axis. Because the coordinate system created by the function cannot be created and so the Orientation of the resulting Quaternion is spinning around the y-axis So I try to cover this edge case by using
if(Vector3.Angle(normal, new Vector3(0, 1, 0)==0) ||Vector3.Angle(normal, new Vector3(0, 1, 0)==180) )
After Debugging I realized that the problem is occuring for each Vector3.Angle(normal, new Vector3(0, 1, 0) between 170 and 180. I need to get a really precise orientation, so my question is do you know why this inaccuraccy is happening and how it can be properly handled. Thank you !