public static void UpdateTransformPlane(Transform planeT, Plane3 update) { planeT.position = update.CalcOrigin(); Vector3 u, v, n; update.CreateOrthonormalBasis(out u, out v, out n); planeT.transform.rotation = Quaternion.LookRotation(u, n); //planeT.up = update.Normal; }
protected void DrawPlane(ref Plane3 plane, Transform Plane) { Vector3 u, v, n; plane.CreateOrthonormalBasis(out u, out v, out n); Matrix4x4 m = new Matrix4x4(); m.SetColumn(0, u); m.SetColumn(1, n); m.SetColumn(2, v); m.SetColumn(3, Plane.position); m.m33 = 1f; Gizmos.matrix = m; Gizmos.DrawCube(Vector3.zero, new Vector3(10, 0, 10)); Gizmos.matrix = Matrix4x4.identity; }
protected void DrawPlane(ref Plane3 plane, Transform Plane) { Vector3 u, v, n; plane.CreateOrthonormalBasis(out u, out v, out n); Matrix4x4 m = new Matrix4x4(); m.SetColumn(0, u); m.SetColumn(1, n); m.SetColumn(2, v); m.SetColumn(3, Plane.position); m.m33 = 1f; Gizmos.matrix = m; Gizmos.DrawCube(Vector3.zero, new Vector3(10, 0, 10)); Gizmos.matrix = Matrix4x4.identity; /* * GameObject planeObject = Resources.Load("Plane") as GameObject; * planeObject = Instantiate(planeObject); * planeObject.transform.position = Plane.position; * planeObject.transform.Rotate(Plane.eulerAngles);*/ }