Author Topic: CenterOnChild with Draggable Camera  (Read 9052 times)

Amitloaf

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
CenterOnChild with Draggable Camera
« 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: CenterOnChild with Draggable Camera
« Reply #1 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.

Amitloaf

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
Re: CenterOnChild with Draggable Camera
« Reply #2 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! :)

Amitloaf

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
Re: CenterOnChild with Draggable Camera
« Reply #3 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: CenterOnChild with Draggable Camera
« Reply #4 on: April 09, 2013, 09:29:21 AM »
Search for "SoftClip". You will find the shader NGUI uses. So yes, you can.

Amitloaf

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
Re: CenterOnChild with Draggable Camera
« Reply #5 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!