/// <summary> /// Add multiple control points. Should be in world space. /// </summary> /// <param name="newPoints"></param> /// <param name="newRotations"></param> public void AddControlPoints(List <Vector3> newPoints, List <Quaternion> newRotations) { this.Points.AddRange(newPoints.Select(ct => this.transform.InverseTransformPoint(ct))); this.Rotations.AddRange(newRotations.Select(rotation => Quaternion.Inverse(this.transform.rotation) * rotation)); Mesh mesh = RibbonMesh.AddPoints(this.Points, this.Rotations); UpdateMesh(mesh); }
private void addPointsToRibbon() { List <Vector3> points = new List <Vector3>(); List <Quaternion> rotations = new List <Quaternion>(); foreach (Transform controlPoint in ControlPointParent.transform) { GetComponent <MeshFilter>().mesh = ribbonMesh.AddPoints(new List <Vector3> { controlPoint.position }, new List <Quaternion> { controlPoint.rotation }); points.Add(controlPoint.position); rotations.Add(controlPoint.rotation); } //GetComponent<MeshFilter>().mesh = RibbonMesh.GetRibbonMesh(points, rotations, .4f); }