1
Support / tk2dUI woking with 2D physics
« on: December 24, 2013, 02:53:13 pm »
I got some of the UI working with the new unity 2D physics, all i did was add the code below to the RaycastForUIItem method in tk2dUIManager script inside the for loop
if you chose to comment the 3D physics part, you can also get the mouse point using
NOTE: 2D colliders closer to the camera will be triggered first
Code: [Select]
Collider2D c = Physics2D.OverlapPoint (ray.origin, currCamera.FilteredMask);
if (c != null)
{
return c.GetComponent<tk2dUIItem>();
}
if you chose to comment the 3D physics part, you can also get the mouse point using
Code: [Select]
Vector2 mouseWorldPosition = currCamera.HostCamera.ScreenToWorldPoint (screenPos);
NOTE: 2D colliders closer to the camera will be triggered first