Why is my raycast not colliding with the ground?

For some reason, no collision is detected and I’m not sure why. I want it to hit ONLY the “Ground” layer.

void OnCollisionEnter2D(Collider2D otherCollider){

wallPosition.Set (otherCollider.gameObject.GetComponent<BoxCollider2D> ().bounds.min.x, otherCollider.gameObject.GetComponent<BoxCollider2D> ().bounds.max.y);
}


void Update () {
if (Physics.Raycast (wallPosition, Vector3.down, Mathf.Infinity, 1 << 10)) {
						Debug.Log ("collision!");
}
}

Instead of using 1 << 10 you should use LayerMask.NameToLayer("Ground") or make a public LayerMask variable and use that because maybe you got the index wrong. Make sure that you have a “Ground” layer too.