- Home /
2D sprite rotation with velocity and interpolation
Hi guys,
New here, looking for some advice over an issue i've been pulling my hair out for hours over.
I've applied velocity to my 2D sprite character to move it.
With interpolation applied to the rigidbody2D, the movement is smooth as silk. This is great. Without interpolation, the movement is jittery.
One of its abilities requires it to rotate. I rotate it using:
this.transform.Rotate(0, 0, -180);
Unfortunately, the character changes position slightly every time i rotate (rotation amount does not matter. even 1 degree causes it to move.)
Turning off interpolation fixes this, but causes the unwanted jittery effect.
Turning off velocity fixes this, but of course now my character cannot move.
Does anybody know how I may solve this?
Any help is appreciated!
Answer by g8minhquan · Oct 15, 2014 at 05:25 AM
Don't rotate the transform, use Rigidbody2D ' s methods like Rigidbody2D.AddTorque instead