Eonirr

Untitled

Jan 27th, 2026
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public AnimationCurve rotationCurve;
  2.  
  3. public float targetSpeed;
  4. public float speedlerp;
  5.  
  6. float currentSpeed;
  7. float curvePosition;
  8.  
  9. public bool isRotating;
  10.  
  11. void Update()
  12. {
  13. if(isRotating)
  14. {
  15. currentSpeed = Mathf.Lerp(currentSpeed, targetSpeed, speedlerp * Time.deltaTime);
  16. }
  17. else
  18. {
  19. currentSpeed = Mathf.Lerp(currentSpeed, 0, speedlerp * Time.deltaTime);
  20. }
  21. curvePosition += Time.deltaTime;
  22.  
  23. float curveMultiplier = rotationCurve.Evaluate(curvePosition);
  24.  
  25. float finalSpeed = currentSpeed * curveMultiplier;
  26.  
  27. transform.Rotate(Vector3.right, finalSpeed * Time.deltaTime, Space.Self);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment