Rotation animation 2d object
Hi. This me code that rotates 2d object. But I decided to rotate this with animation and found that Quaternion.Slerp might help with this. I was playng with Slerp but was not able to make it working. This is original code that rotates 2d oblect
void RotateRight (RaycastHit2D block)
{
block.collider.gameObject.transform.Rotate (Vector3.forward * -90);
.....
This what I tried to use
Quaternion finalRotation = Quaternion.AngleAxis(-90f, Vector3.forward);
block.collider.gameObject.transform.rotation = Quaternion.Slerp (block.collider.gameObject.transform.rotation, finalRotation, Time.deltaTime);
This rotates the block but not 90 degrees and I do not see any animation. Can you please help with that. Thanks!
Comment