PolygonCollider2D - Collision detection doesn't work

Hello.
this is what I’ve been doing. (2D game project)

  1. Items are floating around(with Rigidbody2D, CircleCollider).
  2. generate triangle mesh dynamically(with PolygonCollider).
  3. get Items within triangle mesh.

but collision detection won’t work between items and triangle.

someone please let me know what’s wrong with this…

I have tried turn isTrigger both on/off, and isKinematic both on/off.

43880-001.jpg
43881-002.jpg

using UnityEngine;
using System.Collections;

public class PolygonColCtr : MonoBehaviour {

	
	void OnCollisionEnter2d (Collision2D coll)
	{

		if (coll.gameObject.tag == "ITEM")
		{
			Debug.Log ("Caught ITEM!");
	
		}

	}

}

Put the Rigidbody2D on the PolygonCollider.

I had the same problem. Circle Colliders can only collide with colliders that have a rigibody2D attached. Polygon doesn’t need that.

if that doesn’t work, attach the rigidbody to both.^^

and if that also doesn’t work^^

On what Layers are those GameObjects?
Is it possible that they ignore each other?

Try to go in the Menu: Edit → Project Settings → Physics2D and scroll down until you see a collision Matrix and check the box where both meet, or put them on layers that don’t ignore each other :wink: