Basically, I wanted to determine whether there is any obstacle between Player and Target. And then return the target info. I tried to use Raycast, but feel free to offer alternative if you can provide one.
I managed to get the Raycast line stopped at where the collider is. But I don't know how to get the variables from the object which the collider is attached to.
Also, is there anyway to widen the ray? In case the player might not be able to pass through gap between objects.
Code so far:
All the information is in your RaycastHit. you have access to the collider, and from there everything with GetComponent.
You can't widen the ray, but you can cast several by spacing them of transform.right, left, up etc.
answered Jun 05 '12 at 10:50 PM