Rotate Between Two Angles - Unity Tutorial Basics

Pubblicato il: 29 novembre 2020
sul canale di: Little Arch Games
9,643
159

Basic tutorial on rotating a gameobject between two angles in Unity. This is the easiest way I've found to rotate a game object between two angles back and fourth. There might be better ways to do this for your project but I find this way works for me. You can also serialize a field for the angle to move between and the starting angles so they are configurable in the inspector.


If you liked this, check out my game Escapea available on Android and iOS.
Android - https://play.google.com/store/apps/de...
iOS - https://apps.apple.com/us/app/escapea...


Thanks for Watching!


Script:


{
[SerializeField] float rotateSpeed = 60f;

void Update()
{
transform.localEulerAngles = new Vector3(0, 0, Mathf.PingPong(Time.time * rotateSpeed, 180) - 45);
}
}


In questa pagina del sito puoi guardare il video online Rotate Between Two Angles - Unity Tutorial Basics della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Little Arch Games 29 novembre 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 9,643 volte e gli è piaciuto 159 spettatori. Buona visione!