So I have a raycast script attached to an empty game object I can see the Debug.DrawRay but when my player walks into it the debug.log does nothing here is my code:
function Update ()
{
Debug.DrawRay (transform.position, Vector3.forward * 10, Color.green);
var hit : RaycastHit;
if ( Physics.Raycast( transform.position, transform.forward, hit, 100.0 ) )
{
if (hit.collider.tag == "Player")
{
Debug.Log("HIT!!!");
}
}
}
↧