public void SetPlane(Vector3 firstVertexRight, Vector3 firstVertexLeft, Vector3 secondVertexRight, Vector3 secondVertexLeft) { this.firstVertexRight = firstVertexRight; this.firstVertexLeft = firstVertexLeft; this.secondVertexRight = secondVertexRight; this.secondVertexLeft = secondVertexLeft; this.i = (secondVertexLeft - firstVertexLeft); this.j = (firstVertexRight - firstVertexLeft); this.k = Vector3.Cross(i, j).normalized; this.planeOrigin = this.firstVertexLeft; this.planeNormal = this.k; baseMatrix = MatrixInverseProgram.MatrixCreate(3, 3); baseMatrix[0][0] = i.x; baseMatrix[0][1] = j.x; baseMatrix[0][2] = k.x; baseMatrix[1][0] = i.y; baseMatrix[1][1] = j.y; baseMatrix[1][2] = k.y; baseMatrix[2][0] = i.z; baseMatrix[2][1] = j.z; baseMatrix[2][2] = k.z; inverseMatrix = MatrixInverseProgram.MatrixInverse(baseMatrix); }