Collision Callbacks not triggering

In the process of migrating my cocos creator 2.4 project to cocos creator 3.7, I encountered a problem where i am not getting Collision callbacks in my code. After some digging, i got to know that Rigidbody2d is required with “Enable contact listener” and the coding changed from OnCollionEnter to registering my function to “Contact2DType.BEGIN_CONTACT”. After making these changes i am still not getting any collision callbacks. Can you guys please help with what could be the reason that callbacks are not getting triggered? am I missing something else that needs to be addressed?
Thanks

Hi, i’m relatively new on Cocos Creator, but i hope i can help you because i’m working on collision from a while me too.

At your node you need add two components, RigidBody2d (Kinematic, Static or Dynamic, depends on your needs) and a BoxCollider (Circle or whatever you need).

See at this example:

After that create all other elements with a rigidBody and a shape collider. Add your component a script where you need to declare these as follows.

Add this part at your start method:
image

And then declares onBeginContact and onEndContact (or simply one of them, there are preSolve and postSolve too as events):

When your object start to collides to another one, onStartContact will be executed. I share you here a link to the documentation about it
http://docs.cocos.com/creator/3.7/manual/en/physics-2d/physics-2d-contact-callback.html

Hope i helped you to find a solution, keep it up