// Update is called once per frame
    void Update()
    {
        //log statistics
        Pipeline_OSS.LogPixelStats();

        //if end of path is reached
        if (index == positions.Length)
        {
            //save logs
            Pipeline_OSS.SaveLogCSV(name + " FirstTest");
            Debug.Break();
            if (loop)   //return to start if loop is enabled
            {
                transform.SetPositionAndRotation(positions[0], Quaternion.Euler(rotations[0]));
                index = 1;
            }
            else
            {
                return;
            }
        }

        //calculate new position
        Vector3 newPos = Vector3.Lerp(positions[index - 1], positions[index], progress);
        Vector3 newRot = Vector3.Lerp(rotations[index - 1], rotations[index], progress);

        transform.SetPositionAndRotation(newPos, Quaternion.Euler(newRot));

        progress += speed / distances[index - 1] * 1 / 30; //speed depending on framerate

        if (progress > 1)                                  //move to next waypoint if current one is reached
        {
            progress = 0;
            index++;
        }
    }