private void fillVerts() { rightVerts = new Vector3[Resolution + 1]; leftVerts = new Vector3[Resolution + 1]; for (int i = 0; i <= Resolution; i++) { float s = (((float)i) / ((float)Resolution)); Vector3 midPoint = bezier.At(s); Vector3 tangent = bezier.TangentAt(s)[1] - bezier.TangentAt(s)[0]; Vector3 toRight = (new Vector3(tangent.z, tangent.y, -tangent.x)).normalized; rightVerts[i] = midPoint + toRight * ((widthEnd - widthStart) * s + widthStart); leftVerts[i] = midPoint - toRight * ((widthEnd - widthStart) * s + widthStart); if (float.IsNaN(rightVerts[i].x) || float.IsNaN(rightVerts[i].y) || float.IsNaN(rightVerts[i].z) || float.IsNaN(leftVerts[i].x) || float.IsNaN(leftVerts[i].y) || float.IsNaN(leftVerts[i].z)) { rightVerts[i] = Vector3.zero; leftVerts[i] = Vector3.zero; //Debug.LogError("Somewhere NaN"); } } }