Author Topic: colliders out of panel can be pressed  (Read 7343 times)

rganeyev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
colliders out of panel can be pressed
« on: February 04, 2013, 09:36:52 AM »
I have a scrollview, made by panel with clip range and buttons in that scrollview. Every button has a collider, as shown in picture.

The problem is that colliders could take touches out of panel. If you'll tap or swipe in the left of panel in place where orange gizmo is drawn, collider of item0 will take touch.

I made this by looking to scrollview panel example, but in example there's no that behaviour. It seems that I forget to do something. Please, tell me what's my mistake?

« Last Edit: February 04, 2013, 09:45:00 AM by rganeyev »

dlewis

  • Guest
Re: colliders out of panel can be pressed
« Reply #1 on: February 04, 2013, 06:46:08 PM »
The example has colliders on the outside of the clipping area to stop touches to invisible objects. Make sure the blocking colliders are in front of the objects you want to block.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: colliders out of panel can be pressed
« Reply #2 on: February 04, 2013, 07:46:54 PM »
There is an option on the UICamera to clip colliders ("Clip Raycasts"). Turn it back on.

rganeyev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: colliders out of panel can be pressed
« Reply #3 on: February 05, 2013, 01:09:05 AM »
Couldn't find "Clip Raycasts" option neither property like it on UICamera. Is that new feature or maybe it's not on UICamera script?

lime-green.at

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: colliders out of panel can be pressed
« Reply #4 on: February 05, 2013, 02:49:39 AM »


If you cant find it in the inspector, turn it on by script:
  1. cameraGO.getComponent<UICamera>().clipRaycasts = true;

rganeyev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: colliders out of panel can be pressed
« Reply #5 on: February 05, 2013, 02:55:35 AM »
it seems that I have outdated version of ngui(2.2.2), that's why there's no such field in UICamera.
Thx for help!

lime-green.at

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: colliders out of panel can be pressed
« Reply #6 on: February 05, 2013, 03:04:19 AM »
Here's how to update your ngui version: http://www.tasharen.com/forum/index.php?topic=1440.0

rganeyev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: colliders out of panel can be pressed
« Reply #7 on: February 05, 2013, 04:14:45 AM »
Thank you for help!