Author Topic: Problem with using Mesh Colliders with buttons  (Read 2371 times)

Agent_007

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 27
    • View Profile
Problem with using Mesh Colliders with buttons
« on: November 25, 2013, 04:31:16 AM »
Is there any easy way to use Mesh Colliders with NGUI buttons?

e.g. if I would like to do accurate hexagon shaped buttons that are right next to each other (~1 pixel between buttons) would it be possible with Mesh colliders?

Currently it seems that mesh collider only triggers with NGUI when Convex is ON, but naturally that breaks collider accuracy. It seems 2D toolkit has something like that (Collider Cap), but is there something similar in NGUI?
http://2dtoolkit.com/forum/index.php?topic=2052.0

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with using Mesh Colliders with buttons
« Reply #1 on: November 25, 2013, 05:04:40 AM »
When creating your collider mesh, just give it a volume (example: instead of a rectangle, create a cube).

Agent_007

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 27
    • View Profile
Re: Problem with using Mesh Colliders with buttons
« Reply #2 on: November 25, 2013, 05:56:12 AM »
Thanks. Your tip works.

It is a bit strange that a box collider works correctly with zero Z size, but with mesh collider one needs to have volume.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with using Mesh Colliders with buttons
« Reply #3 on: November 25, 2013, 07:40:28 PM »
You can set its Z to 0 as well. It just needs to have a volume to start with. Box collider also has a volume.