Eonirr

Untitled

Jan 27th, 2026
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public AnimationCurve rotationCurve;
  2. public float rotationAngle;
  3. public float rotationSpeed;
  4.  
  5. private float curvePosition = 0f;
  6. private Quaternion startRot;
  7.  
  8. private void Start()
  9. {
  10. startRot = transform.rotation;
  11. }
  12.  
  13. private void Update()
  14. {
  15. if (rotationCurve == null) return;
  16.  
  17. curvePosition += rotationSpeed * Time.deltaTime;
  18.  
  19. curvePosition %= 1f;
  20.  
  21. float curveValue = rotationCurve.Evaluate(curvePosition);
  22.  
  23. transform.rotation = startRot * Quaternion.Euler(0f, curveValue * rotationAngle, 0f);
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment