// True if valid. protected bool setTransformPlayback(TransformRecord transformRecord) { if (transformRecord.isValid) { isValid = transformRecord.isValid; positionKey = transformRecord.positionKey; rotationKey = transformRecord.rotationKey; return(true); } return(false); }
IEnumerator WriteCurves() { float time = 0; //reset variables positionKey = new KeyframeVector3(); rotationKey = new KeyframeQuaternion(); scaleKey = new KeyframeVector3(); float removeTime = 0; while( recording == true ) { time = RePlayTimeline.SELF.CurrentTime(); //remove keyframes that are not within timeframe removeTime += keyframeInterval; if( removeTime > 1 ) { CheckMaxTime(time); removeTime = 0; } //position if( recordPosition == true ) { positionKey.AddKeyframe( transform.position, time ); } //rotation if( recordRotation == true ) { rotationKey.AddKeyframe( transform.rotation, time ); } //scale if( recordScale == true ) { scaleKey.AddKeyframe( transform.localScale, time ); } yield return new WaitForSeconds( keyframeInterval ); } //remove keyframes that are not within timeframe CheckMaxTime(RePlayTimeline.SELF.CurrentTime()); //when recording stops, write to curves if( recordPosition == true ) { positionKey.SetCurves(); } if( recordRotation == true ) { rotationKey.SetCurves(); } if( recordScale == true ) { scaleKey.SetCurves(); } yield return null; }