private void GenerateMesh() { UOUtility.DestroyChildren(generated); _bounds = new Bounds(); int i = 0; float textureOffset = 0.0f; foreach (CubicBezierCurve curve in spline.GetCurves()) { GameObject go = UOUtility.Create("segment " + i++, generated, typeof(MeshFilter), typeof(MeshRenderer), typeof(ExtrusionSegment), typeof(MeshCollider)); go.GetComponent <MeshRenderer>().material = material; ExtrusionSegment mb = go.GetComponent <ExtrusionSegment>(); mb.SetShapeVertices(shapeVertices, false); mb.SetLoopAround(loopAround, false); mb.SetTextureScale(textureScale, false); mb.SetCurve(curve, true); mb.SetTextureOffset(textureOffset, true); textureOffset += curve.Length; _bounds.Encapsulate(go.GetComponent <MeshFilter>().sharedMesh.bounds); } }
private void GenerateMesh() { UOUtility.DestroyChildren(generated); int i = 0; foreach (CubicBezierCurve curve in spline.GetCurves()) { GameObject go = UOUtility.Create("segment " + i++, generated, typeof(MeshFilter), typeof(MeshRenderer), typeof(ExtrusionSegment), typeof(MeshCollider)); go.GetComponent <MeshRenderer>().material = material; ExtrusionSegment mb = go.GetComponent <ExtrusionSegment>(); mb.SetShapeVertices(shapeVertices, false); mb.SetTextureScale(textureScale, false); mb.SetCurve(curve, true); } }