void playFrame() { KeyframeBar holder = GameObject.Find("KeyframeBar/KeyframeGameRegistry").GetComponent <KeyframeBar>(); //Debug.Log("HOLDER TARGET---------------------" + holder.motionCaptureTarget.transform.parent); target.transform.position = playbackKeys[currentFrame].Position; target.transform.rotation = playbackKeys[currentFrame].QRotation; //subframeCount++; dorsalAmount = playbackKeys[currentFrame].DorsalAmount; lpelvicHAmount = playbackKeys[currentFrame].LPecAmount.x; lpelvicVAmount = playbackKeys[currentFrame].LPecAmount.y; rpelvicHAmount = playbackKeys[currentFrame].RPecAmount.x; rpelvicVAmount = playbackKeys[currentFrame].RPecAmount.y; analHAmount = playbackKeys[currentFrame].AnalAmount.x; analVAmount = playbackKeys[currentFrame].AnalAmount.y; if (fishModel == FishType.Poeciliid) { Messenger <float> .Broadcast("AdjustDorsalFin", dorsalAmount); Messenger <float, float> .Broadcast("AdjustLPelvicFin", lpelvicHAmount, lpelvicVAmount); Messenger <float, float> .Broadcast("AdjustRPelvicFin", rpelvicHAmount, rpelvicVAmount); Messenger <float, float> .Broadcast("AdjustAnalFin", analHAmount, analVAmount); } playbackClock += Time.deltaTime; if (currentFrame == 0) { if (playbackClock > 7) { ProduceScreenShots.TakePic(); currentFrame++; } } else if (playbackClock > (1.0f / (float)playbackRate)) { //Debug.Log("Playback clock: " + playbackClock); playbackClock = 0.0f; //yeild WaitForEndOfFrame; ProduceScreenShots.TakePic(); if (currentFrame == playbackKeys.Count - 1) { isReadyToStartRecording = false; canLoadNextSet = true; currentFrame = 0; currentSetIndex++; target.transform.position = playbackKeys[0].Position; target.transform.rotation = playbackKeys[0].QRotation; Debug.Log("One Batch Finished"); } currentFrame++; } }