First time I attempted this technique:
public IEnumerator DoRotation(float time)
{
var newRotation = Quaternion.AngleAxis(180, Vector3.up) * rework.rotation;
var progress = 0f;
whereas (progress < 1)
{
progress += Time.deltaTime / time;
rework.rotation = Quaternion.Slerp(rework.rotation, newRotation, progress);
yield return new WaitForEndOfFrame();
}
}
Then I used a flag helper inside Replace()
to start out the coroutine solely as soon as however when the rework rotates backwards it additionally begin shifting and when shifting the rework it shakes/stutters.
I had the identical drawback with one other rotation half and when shifting it to FixedUpdate()
it solved the shaking drawback.
I am undecided why it is shaking like that.
I attempted this within the FixedUpdate
:
var newRotation = Quaternion.AngleAxis(180, Vector3.up) * rework.rotation;
rework.rotation = Quaternion.Slerp(rework.rotation, newRotation, Time.deltaTime * rotationSpeed);
Nevertheless it retains rotating the rework 180 levels the other way nonstop.
Easy methods to make the rework rotate backwards in FixedUpdate
as a substitute of in coroutine?