Is there a 2D equivalent to a SphereCast and SphereCastAll, yet?
Or one in the works?
I asked this feature - http://feedback.unity3d.com/suggestions/2d-circlecast-physics-dot-spherecast-for-2d-1.
Please vote.
Does OverlapCircle not do what you need?
Please read my request by the link.
OverlapCircle returns collider of touched objects not the collision/hit points.
Implemented in new Unity 4.5 release - Unity - Scripting API: Physics2D.CircleCastAll
hi i got
RaycastHit2D[ ] obj = Physics2D.CircleCastAll(transform.position,4f,new Vector3 (0,0,0));
foreach ( RaycastHit2D hit in obj) {
Debug.Log (" obj " + hit.collider.gameObject.name);
and that’s working
now when i add obj = hit.transform.gameObject;
i got this result
Assets/Scripts/Bomb.cs(71,25): error CS0029: Cannot implicitly convert type UnityEngine.GameObject' to UnityEngine.RaycastHit2D[ ]’
Uh, you’ve already defined “obj” as a RaycastHit2D[ ]. You can’t subsequently assign a GameObject to it.