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!");
}
}