Created
November 19, 2017 05:41
-
-
Save flushpot1125/19aa4192a209795b7a2382a91a69d6fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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