Пример #1
0
        private void Start()
        {
            // Give the worm an initial length of segmentCount by moving the cursor along the ground
            // from (0, 0, (-segmentCount + 1) * segmentSize) to (0, 0, 0) in increments of segmentSize

            for (int i = -segmentCount + 1; i <= 0; i++)
            {
                cursor.transform.position = new Vector3(0, 0, i * segmentSize);
                cursor.distanceTraveled  += segmentSize;
                cursor.SnapToGround();
                mesh.AddSegment(cursor);

                points.AddFirst(cursor.transform.position);
                rotations.AddFirst(cursor.transform.rotation);
            }

            // Bake the worm mesh so it shows up (this is the only time the mesh is triangulated)

            cursorStoredPos = cursor.transform.position;
            mesh.BakeMesh(cursor, true);
        }