Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public AnimationCurve rotationCurve;
- public float rotationAngle;
- public float rotationSpeed;
- private float curvePosition = 0f;
- private Quaternion startRot;
- private void Start()
- {
- startRot = transform.rotation;
- }
- private void Update()
- {
- if (rotationCurve == null) return;
- curvePosition += rotationSpeed * Time.deltaTime;
- curvePosition %= 1f;
- float curveValue = rotationCurve.Evaluate(curvePosition);
- transform.rotation = startRot * Quaternion.Euler(0f, curveValue * rotationAngle, 0f);
- }
Advertisement
Add Comment
Please, Sign In to add comment