Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Amitloaf on April 09, 2013, 06:25:27 AM

Title: CenterOnChild with Draggable Camera
Post by: Amitloaf on April 09, 2013, 06:25:27 AM
I wanted to create a clipped panel but I need to use items in it which are not NGUI so clipping doesn't work here on the normal clipped panel. I decided to use the clipped camera which works but lacks much of the stuff draggable panel can do, like telling me when the drag is over and stuff. I tried to copy UICenterOnChild and change some stuff when I found out all the missing stuff.
Now I understand from the code that I just need to create a SpringPosition with Begin on the Draggable Camera to the position I need. But I don't know when the drag is over.
Is there a simple way to do that or do I need to throw that event from all the UIDragCamera objects that are connected to that camera?
Title: Re: CenterOnChild with Draggable Camera
Post by: ArenMook on April 09, 2013, 07:30:09 AM
Write your own custom script based on UIDragCamera. It's a tiny script -- 86 lines of code, including comments.
Title: Re: CenterOnChild with Draggable Camera
Post by: Amitloaf on April 09, 2013, 08:24:06 AM
Will do. Just wanted to make sure i'm not missing anything. Thank you for your help! :)
Title: Re: CenterOnChild with Draggable Camera
Post by: Amitloaf on April 09, 2013, 08:40:49 AM
Another question. Can I use a shader that will allow me to use the soft clipping on the non NGUI thing? I couldn't find which material/shader NGUI is using (it's well hidden if there even is one). It will make everything prettier and easier.
Title: Re: CenterOnChild with Draggable Camera
Post by: ArenMook on April 09, 2013, 09:29:21 AM
Search for "SoftClip". You will find the shader NGUI uses. So yes, you can.
Title: Re: CenterOnChild with Draggable Camera
Post by: Amitloaf on April 09, 2013, 02:02:14 PM
Found it and tried to use it but it just makes the image disappear. Well nevermind - guess i'll stick to the camera. Don't know enough on shaders to try and fix it :)
thanks!