void Start() { if (debug) { var points = LocalStorage.LoadList <Vector2>(fileName + ".json"); teddy = new Teddy(points); contour = BuildContourSegments(teddy.triangulation); GetComponent <MeshFilter>().sharedMesh = teddy.Build(MeshSmoothingMethod.HC, smoothingTimes, smoothingAlpha, smoothingBeta); } }
void Build() { if (points.Count < 3) { return; } points = Utils2D.Constrain(points, threshold); if (points.Count < 3) { return; } teddy = new Teddy(points); var mesh = teddy.Build(MeshSmoothingMethod.HC, 2, 0.2f, 0.75f); var go = Instantiate(prefab); go.transform.parent = transform; var puppet = go.GetComponent <Puppet>(); puppet.SetMesh(mesh); puppets.Add(puppet); }