![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | peterhoglund |
How would I get the UV coords based on the sprite size of a AtlasTexture sprite. If I use UV in my shader it seems like it will be based on the full atlas texture.
I am trying to animate a sprite swaying back and forth, but I only want the top part of the sprite to animate. So in my shader I offset the pixels based on UV.y which will be 0 at the top and 1 at the bottom. This works because my image is at the top of the atlas, but when I flip the direction (so that 0 will be at the bottom, which is what I want) it will start to sway very much, I suppose it is because 0 is now way down at the bottom of the atlas and not at the bottom of the sprite edges.
Edit: To be more clear, I am animating the sway in a shader which is also what I need help with. Thanks!