/* Coroutine that overwrites the samples every sample rate seconds. Will update and used last sample index to recursively call itself * until it has reached the end slider sample index, in which case it will force release the left and right grabber. */ private IEnumerator OverwriteNextSample() { if (lastSampleIndex <= DMS.SFS_GetEndSliderSampleIndex()) { alternativeSamplePositions[lastSampleIndex] = samplePositions[lastSampleIndex]; alternativeSampleRotations[lastSampleIndex] = sampleRotations[lastSampleIndex]; samplePositions[lastSampleIndex] = transform.position; sampleRotations[lastSampleIndex] = transform.rotation; DMS.SFS_AdjustSlider("CurrentSlider", lastSampleIndex, 0f); lastSampleIndex++; yield return(new WaitForSeconds(DMS.SBS_GetSampleRate())); yield return(StartCoroutine(OverwriteNextSample())); } else { DMS.OVRG_ForceRelease(gameObject.GetComponent <OVRGrabbable>()); yield return(null); } }