I'm new to using unity and came across a problem when I was following a tutorial. The game is in two dimensional space, and when my player walks over a certain tile the detection never goes off. Here's the code that I have,
function calculateWalk() {
yield WaitForSeconds(0.3);
var hit : RaycastHit;
if(Physics.Raycast (transform.position, Vector3.down, 100.0)) { // Never evaluates to being true
var distanceToGround = hit.distance;
Debug.Log("Hit");
if(hit.collider.gameObject.tag == "tallGrass") {
walkCounter++;
Debug.Log("Tall Grass");
} // END if
} // END if
} // END calculateWalk()
I've made sure to attach the script to my player, as well as tag the tiles that I want with "tallGrass". I've followed what was done in the tutorial, but for some reason it's not working out for me, not sure if this is all the code needed to help solve this problem, if more information is needed let me know, I also set my player 1 unit above the tiles.