- Home /
Rotate a Gui.Texture2d and get it to clip.
Hi,
I have a setup like this:
- whole UI scene
- Small UI scene which is sqaure
rotate gui by roll
Texture2d That I rotate based on the roll of the object
restore gui matrix
close small ui scnene
- Small UI scene which is sqaure
draw background which has an alphad out section the rotating texture sits behind.
Image below explains it probably better than I can.
I saw there was a post about clipping happens before rotation, so is the only way to solve this with a shader or uv texture manipulation?
Thanks
Answer by syclamoth · Nov 13, 2011 at 03:40 AM
Well, simpler than either of those is you can make your roll texture have an alpha (transparency) channel, which makes it a circular cutout! If the texture in the middle is a circle with transparent corners, you won't have to worry about it poking out the edges of the black box.
hmm interesting. it also pitches though so it will uv scroll or scale scroll up and down, won't that affect the circle look and perhaps even stretch into the viewable space? Open to ideas here! :)
Well, if it pitches too, that might be a problem. However, that is a problem which you would have had if you did it any other way, as well... If you reimplement it as a circular mesh with a UV texture, it should be pretty easy to just modify the texture's offset, and you won't have to worry about the transparency thing, either.
interesting. I have a separate setup which is not GUI driven which has the instruments drawn to a texture. I guess I could take your approch with it there.