Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: zhangjiq1983 on November 11, 2012, 10:50:09 PM
-
For example, make a circle button.
I can make it looks circle using alpha channel of the texture.
Can I make it respond to mouse like a circle button too?
-
Of course. If you don't want to respond to the entirety of a square collider, you can pick an arbitrary point, compute the vector from that point to the click location, and then check to see if it falls inside the radius.
This is computer programming. There is very little logic you cannot implement if you are a competent programmer.
-
Of course. If you don't want to respond to the entirety of a square collider, you can pick an arbitrary point, compute the vector from that point to the click location, and then check to see if it falls inside the radius.
This is computer programming. There is very little logic you cannot implement if you are a competent programmer.
no, no I don't think so.
I just take circle buttons for just example.
I want a more general solution, maybe I can test the alpha value of the button after the collider ray trace successed.
-
why don't replace a sphere collider ? or even a mesh collider for custom shape
-
why don't replace a sphere collider ? or even a mesh collider for custom shape
Because UI design is a pixal artist work.
There are lots of icons like sword, shield, apple....and many many more non-rect buttons.
They all have alpha chennels ready, and we use pixel test before in some other engine.
I want to know is this possible in Unity3d and GUI.
-
Then do a coordinate lookup against a source texture and check the returned alpha value or something. There are many ways you could code this. Will NGUI do it for you? No. Can you do it with a little coding? Yes.