Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
private IEnumerator Rotate(float targetAngle){
_swiping = true;
float time = 0;
float initialY = transform.localEulerAngles.y;
Vector3 newEuler;
while (time < 1f) {
newEuler = transform.localEulerAngles;
newEuler.y = MathUtility.LerpAngleUnclamped(initialY, targetAngle, time);
transform.localEulerAngles = newEuler;
time += Time.deltaTime * _swipeSpeedMultiplier;
yield return null;
}
newEuler = transform.localEulerAngles;
newEuler.y = targetAngle;
transform.localEulerAngles = newEuler;
_swiping = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment