Transform.Rotate over specific time

Hi,

I’m trying to rotate an object over a very specific time. Currently I’m using an anim curve to allow easing in and out and then setting the object’s localEulerAngles in the Update method.

		newAngle = new Vector3(initialRot.x + amountToRotate.x, initialRot.y + amountToRotate.y, initialRot.z + amountToRotate.z);
        t += ((Time.deltaTime / duration));

			if(easeType == animEase.AnimCurve)
			{
				float percent = animCurve.Evaluate(t);
				curEuler = (initialRot + percent*(newAngle - initialRot));
			}

			objectToAnimate.transform.localEulerAngles = curEuler;

Unfortunately this doesn’t allow for rotating around the object’s local pivot so I’ve been looking at Transform.Rotate which allows for Space.Self.
If I was to animate the object with a linear animation curve this works perfectly because I can calculate the amount needed to rotate by dividing the required rotation by the duration.

objectToAnimate.transform.Rotate(((amountToRotate.x/duration)*Time.deltaTime), ((amountToRotate.y/duration)*Time.deltaTime), ((amountToRotate.z/duration)*Time.deltaTime));

The problem I’m facing is when I smooth in and out of the rotation. I want to ramp up how much the object will rotate over time and this will mean that the object won’t reach it’s final rotation destination.
I hope I’m just missing something obvious but any help would be much appreciated.

Thanks,

Matt

When i need to rotate over time or do anything over time I tend to fall back to this example

No idea if this is any help.