public IEnumerator DoRotate(float time)
{
var newRotation = Quaternion.AngleAxis(180, Vector3.up) * remodel.rotation;
var progress = 0f;
whereas (progress < 1)
{
progress += Time.deltaTime / time;
remodel.rotation = Quaternion.Slerp(remodel.rotation, newRotation, progress);
yield return new WaitForEndOfFrame();
}
}
Utilization :
non-public void FixedUpdate()
{
if (rotateBackwards)
{
StartCoroutine(DoRotate(3f));
rotateBackwards = false;
}
}
The rotation may be very quick. take much less then a second and for positive not 3 seconds.
Possibly it is higher to do it with out utilizing coroutine ? or one thing within the IEnumerator is incorrect with the time and progress calculation ?