Exemplo n.º 1
0
        protected TransformRecord getTransformRecord()
        {
            positionKey.SetCurves();
            rotationKey.SetCurves();

            TransformRecord transformRecord = new TransformRecord();

            transformRecord.isValid = true;

            transformRecord.positionKey = positionKey;
            transformRecord.rotationKey = rotationKey;
            return(transformRecord);
        }
Exemplo n.º 2
0
	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;
	}