Created
July 14, 2020 21:40
-
-
Save unity3dcollege/a7ba0707246cdb4e9ce3928e0950cc77 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
int nextY = 0; | |
int direction = 1; | |
private void Update() | |
{ | |
if (nextY == 90 || nextY == 0) | |
direction *= -1; | |
nextY += direction; | |
var nextRotation = new Vector3(transform.rotation.eulerAngles.x, nextY, transform.rotation.eulerAngles.z); | |
transform.rotation = Quaternion.Euler(nextRotation); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment