I want to rotate an object by some specific degree, speed and direction in Z-axis and then stop.
This is my code:
Quaternion targetRotation = Quaternion.AngleAxis(currentRotation.rotateValue, Vector3.forward);
float step = currentRotation.speed;
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, step);
With this, I can move with desired speed and angle but the direction is not correct. What I do is move it by 180 after it reaches 180 I move it by 360 and this is in a loop. The problem is that after 360 instead of moving clockwise it moves counter clockwise. Not sure what is going on here need desperate help on this one.
Thanks in advance.
If I understand correctly what you are trying to do, then maybe something like this would work:
NOTES:
Quaternion.Lerp
).