onContactBegin not working as expected

Hi guys,

I have problem with contacts in cocos. I am trying to make a sensor like physics object.
I created on contact function and I am trying to stop PhysicsContact propagation.
I have code snippet like this in my onContactBegin function:

		if ((iTagA == TAG_SNOWBOARD && iTagB == TAG_COIN)
			|| (iTagA == TAG_COIN && iTagB == TAG_SNOWBOARD)) {
			collectCoin();
			contact.stopPropagation();
			return false;
		}

When running code I am trying both contact.stopPropagation() and returning false value,
but contact acts same as if I would return true. It propagates that contact.

Any idea how to stop propagation?

Thanks

what are you using as your masks for each one?

2 Likes

Thanks it was that problem.

I haven’t set CollisionBitmask for Coin.