Have two 2D top down game objects that collide but don't push each other

I’m very new to Unity and I’m developing a two-player top down shooter. Currently I have two player objects that two human players control, each with colliders and rigidbodies, that do collide. My problem is that if one object moves towards the other and collides with it, it will push the collided object in the same direction of movement. My objects move with a set of if statements like this:

if (Input.GetKey(KeyCode.D)) //right
              transform.position += Vector3.right * speed * Time.deltaTime;

What I need to happen is that when an object 1 moves into object 2, object 2 does not get pushed by object 1, and vice versa. Is there a way to accomplish this? Thank you for your response.

In the rigidbody component, there’s a checkbox called “Is Kinematic”. Mark it on the 2 players.

In OnCollisionEnter2D method make velocity and angularVelocity zero for both 2D rigidbodies.

This may solve problem

Well you can make them both triggers but then you will need to edit large parts of code.
Or you can maybe try equalling their mass in the rigidbody.

void OnCollisionEnter(Collision col){
this.velocity = new Vector3(0f, 0f, 0f);