void Update() { lineRenderer.positionCount = points; for (int i = 0; i < points; i++) { lineRenderer.SetPosition(i, section.GetPoint(i * 1.0f / (points - 1))); } }
void Start() { deformingMesh = meshObj.GetComponent <MeshFilter>().mesh; originalVertices = deformingMesh.vertices; displacedVertices = new Vector3[originalVertices.Length]; for (int i = 0; i < originalVertices.Length; i++) { displacedVertices[i] = originalVertices[i]; } centerPos = section.GetPoint(0.5f); meshObj.transform.position = centerPos; Deform(); deformingMesh.vertices = displacedVertices; deformingMesh.RecalculateNormals(); deformingMesh.RecalculateBounds(); }