Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created November 19, 2017 05:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/19aa4192a209795b7a2382a91a69d6fe to your computer and use it in GitHub Desktop.
Save flushpot1125/19aa4192a209795b7a2382a91a69d6fe to your computer and use it in GitHub Desktop.
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