Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question How to rotate by intervals?

Discussion in 'Shaders' started by blinnlambert, May 15, 2024.

  1. blinnlambert

    blinnlambert

    Joined:
    Oct 1, 2013
    Posts:
    2
    I'm creating a loading circle shader with a rotating gradient using a Polar Vortex node driven by Time. I would like to have this rotation snap to 30° intervals instead of smoothly animating the rotation but I'm not sure how to achieve this? upload_2024-5-15_8-40-54.png
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,396
    For future reference, you want the Shader Graph subforum, not the Shader subforum:
    https://forum.unity.com/forums/shader-graph.346/

    As for how to do this, any time you want to have something be stepped like this the math you want to do is this:

    stepped value = floor(value / step size) * step size

    upload_2024-5-15_12-12-50.png