# How can I animate 2d sprite rotation without interpolation?

I would like to animate a weapon being swung in 2 frames - all I'm doing is changing the position and rotation of the weapon sprite. However, I don't want unity to interpolate the rotation (generate sub-frame rotations that smooth out the animation).

How can I do this? Using flat curves (constant tangents) does not work, and my options seem to be Euler interpolation and Quaternion interpolation (there is no "No interpolation" option).

I would like to not have to make spritesheets for every frame of every weapon.

Edit: Here is my current solution, which isn't ideal since I have to specify the number of frames and the speed I want per weapon

IEnumerator AnimateAttackManually () {
float numFrames = attackFrames-1; // 1 frame per second, zero indexed
for(int currentFrame = 0; currentFrame <= numFrames; currentFrame++){
animator.Play("Attack", -1, (currentFrame/numFrames));
animator.speed = 0;
yield return new WaitForSeconds(1/attackSpeed);
}
animator.Play("Idle");
}

• Transform.Rotate doesn't meet your needs? Does that interpolate the rotation? – Cooper Jul 6 '14 at 18:04
• As far as I know Transform.Rotate should indeed meet those needs (not interpolate) – Dries Jul 6 '14 at 18:48
• So instead of adding a keyframe with the new rotation, I should add an event that calls Transform.Rotate? It doesn't look like the parameter constraints (float, string, int, object reference or an AnimationEvent object) would allow me to do that... – Rohit Garg Jul 6 '14 at 19:05
• Do you absolutely have to use the animator for it? This is trivial to do in code alone. – ssb Jul 6 '14 at 23:55
• Sure it's trivial in code, but the animation system should be able to provide support for this. He needs to see if there's a way to configure it to do just that. – leetNightshade Jul 6 '14 at 23:59