Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IEnumerator RotateAxisY()
- {
- while (true)
- {
- var currentRotation = transform.localRotation;
- var newRotation = currentRotation * Quaternion.AngleAxis(rotationSpeed,Vector3.down);
- for (float t = 0; t < 0.5f; t += Time.deltaTime)
- {
- Quaternion rotation = Quaternion.Slerp(currentRotation, newRotation,t * 2);
- transform.localRotation = rotation;
- // yield return null;
- }
- transform.localRotation = newRotation;
- yield return null;
- }
- }
Advertisement