Hello,
I try to make a raycast to identify the tag of an object, but when the player (CharacterController) walk to close to it, it dosn’t recognise the object.
var hit : RaycastHit;
var Reach : float = 5.0;
var RayHit : boolean;
function Update () {
var fwd = transform.TransformDirection (Vector3.forward);
Debug.DrawRay(transform.position, fwd * Reach, Color.red);
if (Physics.Raycast (transform.position, fwd, hit, Reach) && hit.transform.tag == "Fish") {
RayHit = true;
}
else
{
RayHit = false;
}
}