UnityEngine.Matrix3x3.SetOrthoNormalBasis(UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Vector3)

Here are the examples of the csharp api UnityEngine.Matrix3x3.SetOrthoNormalBasis(UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Vector3) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : Matrix3x3.cs
License : MIT License
Project Creator : focus-creative-games

public static bool LookRotationToMatrix(Vector3 viewVec, Vector3 upVec, out Matrix3x3 m)
		{
			m = Matrix3x3.idenreplacedy;

			Vector3 z = viewVec;
			// compute u0
			float mag = z.Length();
			if (mag < Mathf.Epsilon)
			{
				return false;
			}
			z /= mag;

			Vector3 x = Vector3.Cross(upVec, z);
			mag = x.Length();
			if (mag < Mathf.Epsilon)
			{
				return false;
			}
			x /= mag;

			Vector3 y = Vector3.Cross(z, x);
			if (!Mathf.CompareApproximate(y.Length(), 1.0F))
				return false;

			m.SetOrthoNormalBasis(x, y, z);
			return true;
		}