Author Topic: Weird Clipping Panel.IsVisible(Vector3) result  (Read 2342 times)

favoyang

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 14
    • View Profile
Weird Clipping Panel.IsVisible(Vector3) result
« on: June 25, 2014, 05:44:03 AM »
  1. UI Root           # panel.depth = 0
  2.   Camera
  3.     Panel         # height = 800
  4.       Bg Collider # a full screen collider
  5.       Clip Panel  # panel.depth = 1, size 300x300
  6.         Button
  7.  

In a simple 2d UI setup as above, I put a full screen "Bg Collider" at the bottom and a small "Clip Panel" with a "Button" inside on the top. Kind like a trivial modal dialog. If I click the button, it will response me. If I click the rest part of the screen, the "Bg Collider" will capture the event to avoid it pass to any widgets behind the panel. Now the tricky thing is that if I changed transform.localPosition.y of "Clip Panel" to any number bigger than 150, say 160, the button will no longer receive the event.

Digging into NGUI source code, I found that in UICamera.Raycast(Vector3 inPos), mHits will be [Button,Bg Collider], but later IsVisible(lastWorldPosition, Button)) return false. But it shouldn't.

If change the "Clip Panel" to no clipping, then it works again.

Is this a bug? or I shouldn't move a clipping panel by change it's transform?

Please check out the test project at https://bitbucket.org/favoyang/2dhitordertest (you need import NGUI 3.6.5)
« Last Edit: June 25, 2014, 07:34:34 AM by favoyang »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Weird Clipping Panel.IsVisible(Vector3) result
« Reply #1 on: June 25, 2014, 07:44:26 AM »
Can you please attach a unitypackage here or a zip file instead of using bitbucket?

favoyang

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Weird Clipping Panel.IsVisible(Vector3) result
« Reply #2 on: June 25, 2014, 12:48:18 PM »
Sure, see the zip in attachment.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Weird Clipping Panel.IsVisible(Vector3) result
« Reply #3 on: June 26, 2014, 10:07:20 AM »
Thank you, I found the issue and fixed it. You can grab it from the repository if you have Pro access. Otherwise you will find it in Friday's update.

favoyang

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Weird Clipping Panel.IsVisible(Vector3) result
« Reply #4 on: June 26, 2014, 01:30:55 PM »
Great, will double check after receiving the Friday update. Thanks!

favoyang

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Weird Clipping Panel.IsVisible(Vector3) result
« Reply #5 on: June 29, 2014, 01:04:46 AM »
Yes, fixed.