1
NGUI 3 Support / Can use a bit of help on casting a ray.
« on: June 05, 2014, 11:18:40 PM »- void RaycastForHits()
- {
- int hits = Physics2D.OverlapCircleNonAlloc(col.center, 0.5f, results);
- Debug.Log(hits + " hits");
- }
When a 2d collider is touched (OnPress), I am trying to cast a ray from the center of that collider (2d circle), to see if any other objects (of the same type that triggerd the raycast) overlap. I'm sure I'm doing something wrong, and can use a hand. I'm getting erratic results.
Also, I need to set the radius of the ray cast to match the size of the collider (same one used above as col.center).
Any help appreciated.