How do I prevent a Kinematic Rigidbody2D from moving a Dynamic Rigidbody2D on Collision?

Hi. I’m working on a 2D game in Unity 2017.3 (macOS) and have a problem with RigidBody2D collision. For context, I have bullet GameObjects that are interacting with GameObjects with Dynamic RigidBodies in a less-than-optimal fashion for what is required for our project.

These bullet GameObjects have kinematic RigidBodies and do the following OnCollisionEnter2D:

If they collide with other rigid bodies with the same tag or collide with the enemy that spawned them, they disable collision with those GameObjects with Physics2D.IgnoreCollision so that they will not re-collide with them in the future.

If they collide with the player, they run a bunch of code and then destroy themselves with Destroy(this.gameObject, 0f);

If they collide with anything else (such as walls), they destroy themselves with Destroy(this.gameObject, 0f);

Now, my problem is that these GameObjects, which have a kinematic RigidBody, push the player on collision - right before deletion. They also push the enemy that spawned them if the enemy does not explicitly disable collision with the spawned object immediately after creation.

I need OnCollisionEnter2D to still trigger when the GameObject collides with something, as there are various cases that need to be taken into consideration within the codebase. I need the GameObject’s RigidBody to be kinematic, as using dynamic results in unwanted behavior. The GameObject’s RigidBody is kinematic and should not have any mass to push dynamic RigidBodies with (yet it does?). But at the same time, I do not want the object to push other objects that contain Dynamic RigidBodies on collision.

I am using Use Full Kinematic Contacts, and the GameObject has an attached Circle Collider 2D that is not set to trigger (setting to trigger results in OnCollisionEnter2D never being called). If anyone could provide advice on how to rectify the problem, either through code or via the settings in the prefab via the Inspector, that would be very helpful.

Thank you very much.

There are possible solutions to this issue.

One of them may be that you can use Trigger instead of Collider, which will not push any collider aside.

Second could be that you can decrease mass and friction of bullet and increase mass and friction of enemy/player objects, such that bullet cannot push them due to physics.