Quaternion and 360 degree rotations

Hi guys, I’m using the following co-routine to rotate a gameobject over an amount of time:

	IEnumerator RotateObject(float time, Quaternion targetRotation)
 		float tParam = 0.0f;
		Quaternion currentRotation = transform.rotation;
		// Compares angles of two Quaternions
		while (Quaternion.Angle ( transform.rotation, targetRotation) >0.1f) {
			tParam += Time.deltaTime * (1 / time);
 			transform.rotation = Quaternion.Slerp (currentRotation, targetRotation, tParam);
			yield return null;
	 	// Hard lock the rotation
		transform.rotation = targetRotation;

However, I need a function which rotates an object around 360 degrees - with the current code it’ll just take the shortest route (so if I specify 360 degrees it won’t move). So I want to be able to effectively force a direction of rotation. Any ideas how to best accomplish this?

Thanks in advance

try using your transform’s eulerAngles, and updating the rotation that way. It would be similar to using transform.Rotate() except hopefully this way you could have a little easier time counting how long it has been rotating.

    Vector3 rot = transform.rotation.eulerAngles;
    rot.y += 1f;
    transform.rotation = Quaternion.Euler(rot);

Putting something like that in your Coroutine could be what you’re looking for. either that or transform.Rotate could work, you’d just have to keep track manually of how far you’ve rotated.