private static Vector3 GetNormal(Triangle triangle) { return(Vector3.Cross(triangle.V2 - triangle.V1, triangle.V3 - triangle.V1).normalized); }
// Helpers internal static Triangle Transform(Matrix4x4 matrix, Triangle triangle) { var v1 = matrix.MultiplyPoint( triangle.V1 ); var v2 = matrix.MultiplyPoint( triangle.V2 ); var v3 = matrix.MultiplyPoint( triangle.V3 ); return new Triangle( v1, v2, v3 ); }
// Helpers private static bool Filter(Triangle triangle, Decal decal) { var normal = GetNormal(triangle); return(Vector3.Angle(Vector3.back, normal) <= decal.MaxAngle); }