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.