Author Topic: How do you correctly handle different collision boxes on the same prefab.  (Read 1313 times)

Erbacher

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 17
    • View Profile
Hello,

I am trying to create a prefab which has a number of collision boxes on it so I can have a user interact with this prefab in different ways.



As you can see from the image I have a large collision box covering more than the size of the prefab which I have hooked up to a method which is called when OnHover is true over this area.
This collision box for the OnHover, is part of the parent of the prefab and has been set behind the children of the prefab in the Z axis. (20 pixels behind the rest of the collision boxes).

My problem is that the method which is meant to be called when the OnDrag collision boxes is set to true (when the user clicks and drags from these areas), not longer gets called.
I understand that the bigger collision box must be blocking the interaction with the Drag collision boxes.

If someone could let me know how I can control my collisions boxes better I would be extremely happy.

Thanks for your time.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
NGUI doesn't use collider's position or Z by default. It instead goes by widget's depth.

To achieve what you're trying to do, add invisible widgets (ALT+SHIFT+W) with colliders on them (ALT+SHIFT+C), not just raw colliders.